A TaxPayer has a name, a yearly salary and a tax credit (both
floating-point
values).
The amount of tax paid by a TaxPayer is calculated as follows. 20% is
paid on
the first €34,000 and 41% is paid on the remainder (if any). Finally,
the tax credit
is deducted from this amount, but this cannot of course reduce the tax
to less than
zero. For example, if John has a salary of €60,000 and a tax credit of
€5,000, his
total tax is calculated as follows:
20% of €34,000: +€ 6,800
41% of (€60,000 – 34,000): +€ 10,660
deduct tax credit: -€ 5,000
Total tax due: € 12,460
Implement in Ruby the TaxPayer class, implementing whichever methods you
deem appropriate. Using this class, write a script that reads a name,
salary and tax
credit from a file called “taxpayer.dat”, and uses this data to create a
TaxPayer
object. Finally, the name and total tax due from this Taxpayer object
should be
printed to the screen.
A sample “taxpayer.dat” input file for the above example would be:
John
60000
5000
(
On Wed, Dec 1, 2010 at 8:37 PM, Derek Zoolander [email protected] wrote:
can anyone do this ?
I’d ask at the Zoolander Center For Children Who Can’t Read Good And
Wanna Learn To Do Other Stuff Good Too.
–
Phillip G.
Though the folk I have met,
(Ah, how soon!) they forget
When I’ve moved on to some other place,
There may be one or two,
When I’ve played and passed through,
Who’ll remember my song or my face.
On Wed, Dec 1, 2010 at 9:37 PM, Derek Zoolander [email protected] wrote:
can anyone do this ?
Based on my experience, the people on this list are very helpful and
generous with their time and their knowledge. Especially towards those
who show that they have put some effort into solving a problem on
their own. You didn’t even put an effort into hiding the fact that
it’s a homework assignment. If you had done that, by asking specific
questions when you got stuck, as you actually did the work, I assure
you that you would have gotten some excellent help.