So the question my teacher wrote on the white board is: Input product Name, Quantity, price. Compute the total amount. If total amount is greater than 2000 discount is 5%, if total amount is greater than 5000 discount is 10%, if greater than 10000 discount is 20%
I know that you have to do this kind of format.
if (cost > 2000)
discount = 0.05;
I would put in the correct things before than like
String prodName;
int qty, price;
double cost;
double discount;
I know what I put there is wrong but I think that's how the format of it goes before doing the nested if statement. I really need help on this. I don't need to be given the answers for this because that's spoon-feeding to the max level. I just need some pointers and a guide in order to find out what to do.
Aucun commentaire:
Enregistrer un commentaire