Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Java - help needed!

Options
  • 08-12-2008 6:40pm
    #1
    Closed Accounts Posts: 3,604 ✭✭✭


    Got a question to do for my programming course. Any help would be greatly appreciated. Here is the question:



    County Councils levy water charges on households according to the following schedule:

    The first 10,000 Litres or less if applicable is charged at €0.001 per Litre but this charge is subtracted from the final amount and is called the Domestic Waiver.

    The next 10,000 Litres (10,001 to 20,000) is charged at €0.002 per Litre.

    Finally the Litres from 20,001 upwards are charged at €0.005 per Litre.

    There is a Standing Charge of €20.00 per billing period for water meter rental.



    Design, write and test a program that will input the Present and Previous Meter Readings and will then calculate the quantity of water used, the charges in each range and add the meter rental, subtract the domestic waiver amount applicable and finally calculate the amount due now by the householder.



    The output should include the following and should resemble this example:

    Please Enter previous Meter Reading - - -> 23,675

    Please Enter Present Meter Reading - - - > 62,448

    Water Charge

    .....................................Units......................................Amount Due (€)
    Meter Rental....................................................................20.00
    Present Reading...............62,448
    Previous Reading..............23,675
    Quantity Used.................38,773
    Litres At 0.005 Cents........18,773........................................93.865
    Litres At 0.002 Cents........10,000........................................20.00
    Litres At 0.001 Cents........10,000........................................10.00
    Less Domestic Waiver........................................................-10.00
    Total Amount Due Now......................................................€113.87
    ....................................€113.87

    Press any key to continue . . . .


Comments

  • Registered Users Posts: 610 ✭✭✭nialo


    and your attempt at solving it?


  • Registered Users Posts: 7,468 ✭✭✭Evil Phil


    Have a read of this before you go any further.


  • Closed Accounts Posts: 3,604 ✭✭✭Kev_ps3


    I dont know where to start! If someone could do it for me it would be great. Im a complete noob at programming.


  • Registered Users Posts: 7,468 ✭✭✭Evil Phil


    Kev_ps3 wrote: »
    I dont know where to start! If someone could do it for me it would be great. Im a complete noob at programming.

    Okay, what you need to do is sit down with some paper and a pen and break down this task into smaller tasks. So:

    1. You need to accept user input, go learn how to do that. Actually, let me send you in the right direction. Go have a look at this: http://tinyurl.com/5zamez/
    2. You need to do some maths learn how to do that.
    3. You need to do some maths on the user input, give it a go you'd be amazed at what you learned in steps one and two.
    4. You need to output your results to the screen. If you've attempted one, two and three that should be childs play.
    5. Understand that unless you make an effort, not matter how weak it may seem, you'll never progress in programming.

    Thread locked.


This discussion has been closed.
Advertisement