From: Sam Duncan Date: 2010-12-02T04:44:55+09:00 Subject: Re: assignment reading file --------------030801010209000102010609 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Yes, there are no restrictions on who can do this. On 02/12/10 08:37, Derek Zoolander wrote: > *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 €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 > ( > > thanks > > --------------030801010209000102010609--