how to write the calculation of this

 DevX Home Today's Headlines   Articles Archive   Tip Bank   Forums

# Thread: how to write the calculation of this

1. Mona Guest

## how to write the calculation of this

RAM:

RAM is available in the units of 64Mb or 128Mb. The user may choose either
64Mb or 128Mb or 192Mb or 256Mb as the total RAM for the PC Box. Any other
value entered by the user is not to be accepted. If the user requires 192Mb
to RAM then three units of 64Mb must be used. If the user requires 256Mb
total RAM then two units of 128Mb must be used. If the total RAM chosen by
the user is either 64Mb or 128Mb then a single unit of the appropriate size
must be used. The price of RAM is calculated at the rate of Dhs 200 per
64Mb.

1.2.Define a sub class called RAM that will extend Hardware.
This class will have additional private data member called size.

A non-default constructor that will get the value of size as a parameter

and set its value accordingly.

Override the method calcPrice() so that the price of RAM is calculated
as per the guideline given earlier (i.e. for every 64Mb, Dhs 200 will be

charged).

2. Jason Bock Guest

## Re: how to write the calculation of this

Homework?

"Mona" <mona941406@yahoo.com> wrote in message
news:3b18fe1f\$1@news.devx.com...
>
>
>
> RAM:
>
> RAM is available in the units of 64Mb or 128Mb. The user may choose either
> 64Mb or 128Mb or 192Mb or 256Mb as the total RAM for the PC Box. Any

other
> value entered by the user is not to be accepted. If the user requires

192Mb
> to RAM then three units of 64Mb must be used. If the user requires 256Mb
> total RAM then two units of 128Mb must be used. If the total RAM chosen by
> the user is either 64Mb or 128Mb then a single unit of the appropriate

size
> must be used. The price of RAM is calculated at the rate of Dhs 200 per
> 64Mb.
>
>
> 1.2.Define a sub class called RAM that will extend Hardware.
> This class will have additional private data member called size.
>
> A non-default constructor that will get the value of size as a parameter
>
> and set its value accordingly.
>
> Override the method calcPrice() so that the price of RAM is calculated
> as per the guideline given earlier (i.e. for every 64Mb, Dhs 200 will be
>
> charged).
>
>

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•

 FAQ Latest Articles Java .NET XML Database Enterprise