Martires de la reforma
package exapa;
/**
*
* @author guadalupe geraldine
*/
public class Pan {
private String pan;
private int cantidad,precio;
public float pan_v()
{float subtotal;
subtotal=cantidad*precio;
return subtotal;
}
public String getPan() {
return pan;
}
public void setPan(String pan) {this.pan = pan;
}
public int getCantidad() {
return cantidad;
}
public void setCantidad(int cantidad) {
this.cantidad = cantidad;
}public int getPrecio() {
return precio;
}
public void setPrecio(int precio) {
this.precio = precio;
}
}
package exapa;
import java.util.Scanner;
publicclass Principal {
public static void main(String[] args) {
String ac="",a="";
String co="concha",or="oreja",bl="bolillo";
float descuento,total=0;
Panp=new Pan();
{
Scanner t=new Scanner(System.in);
System.out.println("El pan es: ");
String pn;
pn=t.nextLine();
p.setPan(pn);System.out.println("La cantidad de pan es: ");
int cd;
cd=t.nextInt();
p.setCantidad(cd);
System.out.println("El preciodel pan es: ");
int po;
po=t.nextInt();
p.setPrecio(po);
if(p.getPan().equalsIgnoreCase(or))
{
ac="pandulce";
a="del 10%";
descuento=p.pan_v()*.10f;
total=p.pan_v()-descuento;
}
else if(p.getPan().equalsIgnoreCase(co)){
ac="pan dulce";
a="del 10%";
descuento=p.pan_v()*.10f;
total=p.pan_v()-descuento;
}
else...
Regístrate para leer el documento completo.