Sei sulla pagina 1di 3

/*

* To change this license header, choose License Headers in Project Properties.


* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package libros;

import javax.swing.JOptionPane;

/**
*
* @author user
*/
public class Libros1 {

boolean mostrarPrecio;

Libros1(String c, String n, int cantidad_existente, int numero_de_paginas,


double costo, double precio, double cantidad_vendida) {
throw new UnsupportedOperationException("Not supported yet."); //To change
body of generated methods, choose Tools | Templates.
}

void Mostrar() {
throw new UnsupportedOperationException("Not supported yet."); //To change
body of generated methods, choose Tools | Templates.
}

void EstablecerNombre(String n2) {


throw new UnsupportedOperationException("Not supported yet."); //To change
body of generated methods, choose Tools | Templates.
}

void EstablecerNumero_De_Paginas(int numero_de_paginas2) {


throw new UnsupportedOperationException("Not supported yet."); //To change
body of generated methods, choose Tools | Templates.
}

void EstablecerPrecio(int i) {
throw new UnsupportedOperationException("Not supported yet."); //To change
body of generated methods, choose Tools | Templates.
}

boolean ObtenerPrecio() {
throw new UnsupportedOperationException("Not supported yet."); //To change
body of generated methods, choose Tools | Templates.
}

void EstablecerNumero_DePaginas(int numero_de_paginas2) {


throw new UnsupportedOperationException("Not supported yet."); //To change
body of generated methods, choose Tools | Templates.
}

void MostrarFinal() {
throw new UnsupportedOperationException("Not supported yet."); //To change
body of generated methods, choose Tools | Templates.
}

boolean mostrarPrecio() {
throw new UnsupportedOperationException("Not supported yet."); //To change
body of generated methods, choose Tools | Templates.
}

public class Libros1 {


String cod, nom;
int cante, numpag;
double costo, precio1, precio, cantven, valven, ganancias;

public Libros1 (String c, String n, int cte, int np, double cos, double pre, double
cv) {

cod = c;
nom = n;
cante = cte;
numpag = np;
precio = PrecioMasPaginas();
cantven = cv;
costo = precio - precio * 0.3;
valven = precio * cantven;
ganancias = valven - (costo * cantven);
}

public void Mostrar(){

JOptionPane.showMessageDialog(null, "Codigo: " + cod + "\nNombre del libro: " +


nom + "\nCantidad existente: " + cante + "\nNumero de paginas: " + numpag +
"\nCosto del libro: " + costo + "\nPrecio del libro: " + precio + "\nCantidad
vendida: " + cantven);
}
public void MostrarFinal(){

JOptionPane.showMessageDialog(null, "Codigo: " + cod + "\nNombre del libro: " +


nom + "\nPrecio del libro: " + precio + "\nCantidad vendida: " + cantven + "\nValor
de venta: " + valven + "\nGanancias: " + ganancias);
}

public double PrecioMasPaginas (){

if (numpag < 200) {

precio = 25000 + (numpag * 10);

} else {

if (numpag >= 200 && numpag <= 300) {

precio = 25000 + (numpag * 20);

}else {

precio = 25000 + (numpag * 30);

}
}
return precio;
}
public String ObtenerNombre(){

return nom;
}

public void EstablecerNombre(String n){

nom = n;
}
public int ObtenerNumeroDePaginas(){

return numpag;
}

public void EstablecerNumeroDePaginas(int np){

numpag = np;
}
public double ObtenerPrecio(){
return precio;
}

public void EstablecerPrecio(double pr){

precio = pr;
}
}
}
}

Potrebbero piacerti anche