Write a C++ program that takes input for the monthly electricity consumption of a household and calculates the total cost. The user should be able to input the consumption in either kilowatt-hours (kWh) or megajoules (MJ). The program should follow these specifications: Begin by asking the user to choose the energy unit, either kWh or MJ (use switch). Request the user to input the monthly consumption for each day, and store these values in an array. Calculate the total monthly consumption and then determine the total cost based on the following rates: $0.12 per kWh $0.08 per MJ Display the calculated total cost to the user in both dollars and euros. Additionally, provide a message indicating whether the consumption is low, moderate or high, based on the following criteria: Below 100 kWh or 50 MJ: Low consumption 100 kWh to 300 kWh or 50 MJ to 150 MJ: Moderate consumption Above 300 kWh or 150 MJ: High consumption End the program with an interesting message related to energy consumption. Remember to include multiple-line comments to identify the owners, explain the purpose, input, and output of the program. Use single-line comments to clarify complicated statements and justify your reasoning. Ensure proper indentation, spacing, and self-documenting variable names. Lastly, test your program with sample data and provide screenshots of two different runs with distinct outputs.

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
Write a C++ program that takes input for the monthly electricity consumption of a
household and calculates the total cost. The user should be able to input the
consumption in either kilowatt-hours (kWh) or megajoules (MJ). The program should
follow these specifications:
Begin by asking the user to choose the energy unit, either kWh or MJ (use switch).
Request the user to input the monthly consumption for each day, and store these
values in an array.
Calculate the total monthly consumption and then determine the total cost based on
the following rates:
$0.12 per kWh
$0.08 per MJ
Display the calculated total cost to the user in both dollars and euros.
Additionally, provide a message indicating whether the consumption is low, moderate,
or high, based on the following criteria:
Below 100 kWh or 50 MJ: Low consumption
100 kWh to 300 kWh or 50 MJ to 150 MJ: Moderate consumption
Above 300 kWh or 150 MJ: High consumption
End the program with an interesting message related to energy consumption.
Remember to include multiple-line comments to identify the owners, explain the
purpose, input, and output of the program. Use single-line comments to clarify
complicated statements and justify your reasoning. Ensure proper indentation,
spacing, and self-documenting variable names. Lastly, test your program with sample
data and provide screenshots of two different runs with distinct outputs.
Transcribed Image Text:Write a C++ program that takes input for the monthly electricity consumption of a household and calculates the total cost. The user should be able to input the consumption in either kilowatt-hours (kWh) or megajoules (MJ). The program should follow these specifications: Begin by asking the user to choose the energy unit, either kWh or MJ (use switch). Request the user to input the monthly consumption for each day, and store these values in an array. Calculate the total monthly consumption and then determine the total cost based on the following rates: $0.12 per kWh $0.08 per MJ Display the calculated total cost to the user in both dollars and euros. Additionally, provide a message indicating whether the consumption is low, moderate, or high, based on the following criteria: Below 100 kWh or 50 MJ: Low consumption 100 kWh to 300 kWh or 50 MJ to 150 MJ: Moderate consumption Above 300 kWh or 150 MJ: High consumption End the program with an interesting message related to energy consumption. Remember to include multiple-line comments to identify the owners, explain the purpose, input, and output of the program. Use single-line comments to clarify complicated statements and justify your reasoning. Ensure proper indentation, spacing, and self-documenting variable names. Lastly, test your program with sample data and provide screenshots of two different runs with distinct outputs.
Expert Solution
steps

Step by step

Solved in 3 steps with 2 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY