Can somebody make this program in java? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Can somebody make this program in java?

A shopkeeper offers 30% discount on purchasing articles whereas the other shopkeeper two successive discounts of 20% and 10% for purchasing the same article. Write a program in java to compute and display which is better offer for coustomer. Take the price of an article as the input.

16th Aug 2017, 4:25 PM
Baibhav Kumar
Baibhav Kumar - avatar
4 Answers
+ 8
I'll give you a hint. "30% discount" means, you multiply the price by (1 - 0.3) = 0.7. "20%, then 10% discount" means, you multiply the price by (1 - 0.2) * (1 - 0.1) = 0.8 * 0.9 = 0.72. (This means that the 30% discount is always better.)
16th Aug 2017, 4:35 PM
Schindlabua
Schindlabua - avatar
0
Buddy I have this logic but I need the syntax of loop to be used here.
16th Aug 2017, 4:57 PM
Baibhav Kumar
Baibhav Kumar - avatar
0
Why do you need a loop?
16th Aug 2017, 5:37 PM
marit vandijk
0
Lol, You're of those programmers, who make problems - solvung problem is "costy"...
16th Aug 2017, 5:38 PM
Michał Bujakowski
Michał Bujakowski - avatar