How to calculate amount and discount in a java program? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How to calculate amount and discount in a java program?

24th May 2018, 3:46 PM
Coding Niffler
Coding Niffler - avatar
5 Answers
+ 3
Assuming the discount is in percentage: double amount = price * (discount / 100.0); Say discount is 50.0% 50.0 / 100.0 = 0.5; Say the price is $120.00; 120.00 * 0.5 = 60.00 Therefore, amount = $60.00. I assume this isn't the answer you are looking for (hopefully it is though!) In which case, please clarify the question further. Most people likely do not want to write entire programs for you.
24th May 2018, 4:20 PM
Rrestoring faith
Rrestoring faith - avatar
+ 3
Whatever the original price is, excluding discount. Selling price.
25th May 2018, 4:34 AM
Rrestoring faith
Rrestoring faith - avatar
+ 1
thanks for the answer...you are right this is not the answer but might work for me....I will be more specific... thanks 👍
24th May 2018, 4:25 PM
Coding Niffler
Coding Niffler - avatar
+ 1
wait double amount = price*(discount/100.0)?
25th May 2018, 3:14 AM
Coding Niffler
Coding Niffler - avatar
+ 1
what price? selling price or cost price?
25th May 2018, 3:14 AM
Coding Niffler
Coding Niffler - avatar