Write a program that calculates average water consumption and average water cost of a house. Program must have the steps below: 1. Ask user to to input monthly consumption for 12 months and store this data in an array. 2. Define a function to calculate monthly cost of water. Store calculated results in an array. Water price is 4 tl/m³ up to 15 m/month (<=15) and 6 tl/m³ for more than 15 m/month. (Not the over consumption. For all consumption.) Display the calculated data on screen. 3. Define a function to calculate average water consumption. 4. Display the results on the screen just as shown below. Microsoft Visual Studio Debug Console Enter water consumption for one month: 5 Enter water consumption for one month: 10 Enter water consumption for one month: 15 Enter water consumption for one month: 20 Enter water consumption for one month: 5 Enter water consumption for one month: 10 Enter water consumption for one month: 15 Enter water consumption for one month: 20 Enter water consumption for one month: 5 Enter water consumption for one month : 10 Enter water consumption for one month: 15 Enter water consumption for one mon th: 20 Month Consumption Price 5.00 10.00 15.00 20.00 5.00 10.00 15.00 20.00 5.00 10.00 15.00 20.00 20.00 40.00 60.00 120.00 20.00 40.00 60.00 120.00 20.00 40.00 60.00 120.00 12 Average water consumption is 12.500000 m3. 123456709 11

icon
Related questions
Question
100%

C language 

Write a program that calculates average water consumption and average water cost of a
house. Program must have the steps below:
1. Ask user to to input monthly consumption for 12 months and store this data in an
array.
2. Define a function to calculate monthly cost of water. Store calculated results in an
array.
Water price is 4 tl/m³ up to 15 m/month (<=15) and 6 tl/m? for more than 15
m/month. (Not the over consumption. For all consumption.) Display the calculated
data on screen.
3. Define a function to calculate average water consumption.
4. Display the results on the screen just as shown below.
E Microsoft Visual Studio Debug Console
Enter water consumption for one month: 5
Enter water consumption for one month: 10
Enter water consumption for one month: 15
Enter water consumption for one month: 20
Enter water consumption for one month: 5
Enter water consumption for one month: 10
Enter water consumption for one month: 15
Enter water consumption for one month: 20
Enter water consumption for one month: 5
Enter water consumption for one month: 10
Enter water consumption for one month:
Enter water consumption for one month: 20
15
Month
Consumption
Price
5.00
10.00
15.00
20.00
5.00
10.00
15.00
20.00
5.00
10.00
15.00
20.00
20.00
40.00
60.00
120.00
20.00
40.00
60.00
120.00
20.00
40.00
60.00
120.00
12
Average water consumption is 12.500000 m3.
Transcribed Image Text:Write a program that calculates average water consumption and average water cost of a house. Program must have the steps below: 1. Ask user to to input monthly consumption for 12 months and store this data in an array. 2. Define a function to calculate monthly cost of water. Store calculated results in an array. Water price is 4 tl/m³ up to 15 m/month (<=15) and 6 tl/m? for more than 15 m/month. (Not the over consumption. For all consumption.) Display the calculated data on screen. 3. Define a function to calculate average water consumption. 4. Display the results on the screen just as shown below. E Microsoft Visual Studio Debug Console Enter water consumption for one month: 5 Enter water consumption for one month: 10 Enter water consumption for one month: 15 Enter water consumption for one month: 20 Enter water consumption for one month: 5 Enter water consumption for one month: 10 Enter water consumption for one month: 15 Enter water consumption for one month: 20 Enter water consumption for one month: 5 Enter water consumption for one month: 10 Enter water consumption for one month: Enter water consumption for one month: 20 15 Month Consumption Price 5.00 10.00 15.00 20.00 5.00 10.00 15.00 20.00 5.00 10.00 15.00 20.00 20.00 40.00 60.00 120.00 20.00 40.00 60.00 120.00 20.00 40.00 60.00 120.00 12 Average water consumption is 12.500000 m3.
Expert Solution
steps

Step by step

Solved in 3 steps with 3 images

Blurred answer