Rounding

A

Amol

This is the part of the problem that I want to solve


..........The rounding rules for
sales tax are that for a tax rate of n%, a shelf price of p contains
(np/100 rounded up to the nearest 0.05) amount of sales
tax................


How to round up the sales tax?
 
A

Alf P. Steinbach

* Amol:
This is the part of the problem that I want to solve


.........The rounding rules for
sales tax are that for a tax rate of n%, a shelf price of p contains
(np/100 rounded up to the nearest 0.05) amount of sales
tax................


How to round up the sales tax?

Since the problem statement calls for rounding up, use the ceil() function.

Read the documentation about this function, and try it out on some
simpler problems, whatever comes naturally.

Then figure out how to round up to nearest 0.01. Try that. Then figure
out how to round up to nearest 0.01. Try that.

Test thoroughly.

And pray fervently that some vacuum-head doesn't try to impress us with
the purity of his head's vacuum by posting code for your homework.
 
B

BobR

Alf P. Steinbach said:
And pray fervently that some vacuum-head doesn't try to impress us with
the purity of his head's vacuum by posting code for your homework.

Hey, I've been called worse and still survived!! <G>

Hi Alf.
 
J

Jim Langston

Amol said:
This is the part of the problem that I want to solve


.........The rounding rules for
sales tax are that for a tax rate of n%, a shelf price of p contains
(np/100 rounded up to the nearest 0.05) amount of sales
tax................


How to round up the sales tax?

rounded up to the nearest 0.05 is kinda weird. But think how you do it
manually and do it in code.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,073
Latest member
DarinCeden

Latest Threads

Top