Rewrite so that it uses pennies for all calculations.Code to round x to closest penny and put in in y is y = (long)Math.round(x) | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Rewrite so that it uses pennies for all calculations.Code to round x to closest penny and put in in y is y = (long)Math.round(x)

Enter amount: 39.96 (this is an input) GST: $2.00 Total = 41.96 https://code.sololearn.com/cfLBoAW8Iyzd/?ref=app

9th Feb 2019, 4:00 AM
czarina smsn
czarina smsn - avatar
3 Answers
+ 5
- take a float or a double - declare a var named gst - declare a var named sum - sum= input + gst
9th Feb 2019, 4:30 AM
Muhd Khairul Amirin
Muhd Khairul Amirin - avatar
+ 1
Please show us your attempt.
9th Feb 2019, 4:15 AM
Diego
Diego - avatar
9th Feb 2019, 4:36 AM
czarina smsn
czarina smsn - avatar