Computer Networking: A Top-Down Approach (7th Edition)
Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN: 9780133594140
Author: James Kurose, Keith Ross
Publisher: PEARSON
Bartleby Related Questions 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.
expand button
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
Check Mark
Knowledge Booster
Background pattern image
Recommended textbooks for you
Text book image
Computer Networking: A Top-Down Approach (7th Edi...
Computer Engineering
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:PEARSON
Text book image
Computer Organization and Design MIPS Edition, Fi...
Computer Engineering
ISBN:9780124077263
Author:David A. Patterson, John L. Hennessy
Publisher:Elsevier Science
Text book image
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:9781337569330
Author:Jill West, Tamara Dean, Jean Andrews
Publisher:Cengage Learning
Text book image
Concepts of Database Management
Computer Engineering
ISBN:9781337093422
Author:Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:Cengage Learning
Text book image
Prelude to Programming
Computer Engineering
ISBN:9780133750423
Author:VENIT, Stewart
Publisher:Pearson Education
Text book image
Sc Business Data Communications and Networking, T...
Computer Engineering
ISBN:9781119368830
Author:FITZGERALD
Publisher:WILEY