Sei sulla pagina 1di 4

// Esteban Nicolas Morales Hernandez, Johann Andrs Rojas Urrego

import java.util.Scanner;
public class ejercicio_8 {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
double laminA, laminB, laminC;
double precA, precB, precC;
int op;
ejecuta_ej8 obj = new ejecuta_ej8();
System.out.println("*****INGRESO DE DATOS******");
System.out.print("\nIngrese la cantaidad de laminas A: ");
laminA=sc.nextDouble();
System.out.print("Precio de laminas A: ");
precA=sc.nextDouble();
System.out.print("\nIngrese la cantaidad de laminas B: ");
laminB=sc.nextDouble();
System.out.print("Precio de laminas B: ");
precB=sc.nextDouble();
System.out.print("\nIngrese la cantaidad de laminas C: ");
laminC=sc.nextDouble();
System.out.print("Precio de laminas C: ");
precC=sc.nextDouble();
obj.setLaminA(laminA);
obj.setLaminB(laminB);
obj.setLaminC(laminC);
obj.setPrecA(precA);
obj.setPrecB(precB);
obj.setPrecC(precC);
obj.calcularCostA();
obj.calcularCostB();
obj.calcularCostC();
obj.calcularDA();
obj.calcularDB();
obj.calculartotalA();
obj.calculartotalB();
obj.calcularTotal();
System.out.println(obj.getLaminA()+" de laminas A valen: "+obj.g
etCostA()+ " el descuento es: "+obj.getAdesc()+" para un total de: "+obj.getTot
alA());
System.out.println(obj.getLaminB()+" de laminas B valen: "+obj.g
etCostB()+ " el descuento es: "+obj.getBdesc()+" para un total de: "+obj.getTot
alB());
System.out.println(obj.getLaminC()+" de laminas C valen: "+obj.g
etCostC());
System.out.println("Pago de contado?");
System.out.println("1. Si");
System.out.println("2. No");
System.out.print("Ingrese su opcin: ");
op=sc.nextInt();
if(op==1){
double total;
total=obj.getTotal()-(obj.getTotal()*.05);
System.out.print("El total seria de : "+total);
}else{
System.out.print("El total seria de: "+obj.getTotal());
}
}
}

--------------------------------------------------------------------------------
----------
public class ejecuta_ej8 {
double laminA, laminB, laminC;
double precA, precB, precC;
double costA,costB,costC;
double Adesc, Bdesc, total,totalA,totalB;

public double getLaminA() {


return laminA;
}
public void setLaminA(double laminA) {
this.laminA = laminA;
}
public double getLaminB() {
return laminB;
}
public void setLaminB(double laminB) {
this.laminB = laminB;
}
public double getLaminC() {
return laminC;
}
public void setLaminC(double laminC) {
this.laminC = laminC;
}
public double getPrecA() {
return precA;
}
public void setPrecA(double precA) {
this.precA = precA;
}
public double getPrecB() {
return precB;
}
public void setPrecB(double precB) {
this.precB = precB;
}
public double getPrecC() {
return precC;
}
public void setPrecC(double precC) {
this.precC = precC;
}
public void calcularCostA(){
costA=laminA*precA;
}
public double getCostA(){
return costA;
}
public void calcularCostB(){
costB = laminB*precB;
}
public double getCostB(){
return costB;
}
public void calcularCostC(){
costC = laminC*precC;
}
public double getCostC(){
return costC;
}
public double getAdesc() {
return Adesc;
}
public void setAdesc(double adesc) {
Adesc = adesc;
}
public double getBdesc() {
return Bdesc;
}
public void setBdesc(double bdesc) {
Bdesc = bdesc;
}
public void setTotal(double total) {
this.total = total;
}
public void calcularDA(){
Adesc=costA*.1;
}
public double getDA(){
return Adesc;
}
public void calcularDB(){
Bdesc=costB*.2;
}
public double getDB(){
return Bdesc;
}
public void calculartotalA(){
totalA=costA-Adesc;
}
public double getTotalA(){
return totalA;
}
public void calculartotalB(){
totalB=costB-Bdesc;
}
public double getTotalB(){
return totalB;
}
public void calcularTotal(){
total=totalA+totalB+costC;
}
public double getTotal(){
return total;
}
}