assignment reading file

  • Thread starter Derek Zoolander
  • Start date
D

Derek Zoolander

can anyone do this ?

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 =E2=82=AC34,000 and 41% is paid on the remainder (if any). Fina=
lly,
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 =E2=82=AC60,000 and a tax cred=
it of
=E2=82=AC5,000, his
total tax is calculated as follows:
20% of =E2=82=AC34,000: +=E2=82=AC 6,800
41% of (=E2=82=AC60,000 =E2=80=93 34,000): +=E2=82=AC 10,660
deduct tax credit: -=E2=82=AC 5,000
Total tax due: =E2=82=AC 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 =E2=80=9Ctaxpayer.dat=E2=80=9D, and uses this d=
ata to create a
TaxPayer
object. Finally, the name and total tax due from this Taxpayer object
should be
printed to the screen.
A sample =E2=80=9Ctaxpayer.dat=E2=80=9D input file for the above example =
would be:
John
60000
5000
(

thanks

-- =

Posted via http://www.ruby-forum.com/.=
 
S

Sam Duncan

[Note: parts of this message were removed to make it a legal post.]

Yes, there are no restrictions on who can do this.
 
P

Phillip Gawlowski

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 Gawlowski

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.
 
A

Ammar Ali

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.

Regards,
Ammar
 

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

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,065
Latest member
OrderGreenAcreCBD

Latest Threads

Top