[Solved] Lab 5 Water Consumption

$25

File Name: Lab_5__Water_Consumption.zip
File Size: 226.08 KB

SKU: [Solved] Lab 5 – Water Consumption Category: Tag:
5/5 - (1 vote)

The city of Paris, Texas tracks how much water is consumed by its citizens on a monthly basis. The City Manager would like statistics about the consumption. She would like to know the months with the highest and lowest consumption, the yearly average, and the yearly total. NOTE: Water consumption is measured in CCF (centum cubic feet)

The main function should:

Create an array to store the twelve months of consumption.

Call the following functions, passing the array to all but the print headers function:

  1. Get data from user: The function should use a loop to ask the user for the amount consumed for 12 months, using the appropriate month name and store the data in the consumption array.

Input Validation: Do not accept negative numbers.

Your screen dialog might look similar to this (user input is shown in bold):

Enter water consumption in CCF for January: 500000Enter water consumption in CCF for February: 400000Etc.
  1. Print the headers: which should ask for the year of the report to be displayed in the header and print the headers. Input Validation: The year should be validated to be between 2005 and 2020.
  2. Display the consumption: Using the data from the consumption array, display the consumption for the year for each month with appropriate month labels.
  3. Get lowest consumption: Using the data from the consumption array, determine the month with the lowest consumption, print the month name and the amount of the consumption for that month.
  4. Get highest consumption: Using the data from the consumption array, determine the month with the highest consumption, print the month name and the amount of the consumption for that month.
  5. Get total and average consumption: Using the data from the consumption array calculate the total and average of all months for the year and print them.

Sample Output

2016 Consumption Report for Paris, Texas Month Consumption in CCF-January 500000February 250000Etc.. The lowest consumption was in March with 100000 CCFThe highest consumption was in July with 900000 CCFThe total consumption for the year: 2000000 CCFThe average consumption for the year: 500000 CCF

Modularity Your program must be a modular program. Your main function should not contain any loops. It should call all of the functions described above, calling a total of 6 functions

Additional Requirements:

  1. Do not use global variables in any assignment. A global variable is a variable that is declared outside any function. It is okay to use global constants.
  2. When passing the array to a function that does not modify it, use the const keyword to prevent any modification to the array.
  3. To find the minimum and maximum values sort the array first.

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[Solved] Lab 5 Water Consumption
$25