[Solved] Calculating a discount java [closed]


Have a think about how you can code simple mathematics into your program, I will start you off with an example.

if (productCost >= 20 && productCost < 60)
{
    discount = 0.9;
}

What this does is check if the cost of the product lies between 20 and 60 and if it does it sets the discount to 0.9. This is 0.9 because when you multiply this by the total cost, it will take 10% off.

Use this as a guideline and try and figure out the other things yourself, you won’t learn without trying at least.

4

solved Calculating a discount java [closed]