This question already has an answer here:
it's give me error on netbeans
could anyone help me. thanks.
double d;
double v;
double p;
String input;
input = JOptionPane.showInputDialog("Please enter the value : ");
v = Double.parseDouble(input);
if (v > 99){
if(v < 200){
d = v * 0.05;
p = v - d;
} else if (v < 300){
d = v * 0.10;
p = v - d;
} else if (v < 400){
d = v * 0.15;
p = v - d;
} else if (v < 500){
d = v * 0.20;
p = v - d;
} else if (v > 499){
d = v * 0.25;
p = v - d;
}
JOptionPane.showMessageDialog(null , "you\'r discount is : " + d + "\n you have to pay : " + p );
} else{
// zero
JOptionPane.showMessageDialog(null, "there is no discount. ");
}
Aucun commentaire:
Enregistrer un commentaire