Water Rates


East London municipality has a staggered water tariff.  This is meant to reduce excessive water consumption by charging a higher tariff the more water a household uses.  You will find these details on a Buffalo City Rates and Taxes account.  Your task is to write a program that will assist home users to calculate their water consumption as follows:  the user enters two water meter readings; the first at the start of a month, and the second from the end of the month.  The volume of water is measured by subtracting the later reading from the earlier reading.  Water rates are charged as follows:

  • The first 6kl are free.
  • Consumption between 6 and 10kl is charged at R3.49 per kl.
  • Consumption between 10 and 20kl is charged at R4.86 per kl.
  • Consumption between 20 and 30kl is charged at R6.61 per kl.
  • Consumption over 30kl is charged at R8.67 per kl.

You must calculate VAT on the final total.

Produce an account, neatly laid out on the output form, for the user to examine.  It must include the following details:

User’s name and address, Account number (use a random number generator to generate a 6-digit account number), the readings the user entered and the calculated result, the VAT and the Total amount the customer owes.

The Task

Use the following steps to tackle the problem:

  1. Restate the problem in its essential terms.  Write the problem down in one sentence.  Next, state the RELEVANT facts you have been provided with.  Next, write a short paragraph outlining the steps you propose to take to solve the problem.

  2. Devise the algorithm.  Write down the INPUTS to the program.  Write down the OUTPUTS from the program.  Consider what VARIABLES you need to find the solution.

  1. Test your algorithm on paper, by assigning some values to the INPUTS, working methodically through the PROCESS you outlined above, then checking your OUTPUTS.  You must test AT LEAST THREE different sets of Inputs, which are composed as follows: values that make sense, values that are numeric, but are inappropriate, eg negative numbers, and values that are completely wrong, eg the user enters words instead of numbers.

  2. At last, the moment you have been waiting for: Write the program.  Be sure to cater for faulty input or impossible input( eg negative numbers or inconsistent input).

  3. Run the program:  Run the program with all your test data first to check if it gives the correct results.  Debug and rerun until answers are correct.  Finally, determine the correct answer to the problem presented.

Credit Blundell@MonktonCoombe

About CDB 360 Articles
Self-Employed Software Developer, Spark, Property Management, Hobby Forestry, Ex-Teacher, Engineering - Wood, Metal, Electrics & Computers. Outdoors - Walk, Cycle, Kitesurf,

Be the first to comment

Leave a Reply

Your email address will not be published.


This site uses Akismet to reduce spam. Learn how your comment data is processed.