8: PGandE.cpp) Consider a gas and electric bill that sets two levels of use as follows: Gas 10.1 therms $1.415 /therm $1.932 /therm Write a program that takes starting and ending readings for gas and electric meters and calculates charges to the nearest cent. Use one function to calculate charges for both gas and electric so as to eliminate duplicate calculations. Electric 558 kwh Tier 1 quantities Tier 1 price Tier 2 Price $.223 /kwh $.281 /kwh

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter6: Modularity Using Functions
Section: Chapter Questions
Problem 3PP
icon
Related questions
Question

Please code using C++ and only use the header <iostream>. The use of any other headers will not be accepted. Thank you.

PGandE.cpp
Gas
Electric
Tier 1 quantities 10.1 therms
Tier 1 price
Tier 2 Price
$1.415 /therm
$1.932 /therm
558 kwh
$.223 /kwh
$.281 /kwh
double charges(double,double,double,double);
amount used
Tier 1 price
Tier 1 amount
Tier 2 price
The first parameter should be the amount of the commodity used. The next three
parameters should be the tier 1 quantity, the tier 1 price, and the tier 2 price for that
commodity. That way, it should find charges for either gas or electric.
Transcribed Image Text:PGandE.cpp Gas Electric Tier 1 quantities 10.1 therms Tier 1 price Tier 2 Price $1.415 /therm $1.932 /therm 558 kwh $.223 /kwh $.281 /kwh double charges(double,double,double,double); amount used Tier 1 price Tier 1 amount Tier 2 price The first parameter should be the amount of the commodity used. The next three parameters should be the tier 1 quantity, the tier 1 price, and the tier 2 price for that commodity. That way, it should find charges for either gas or electric.
8: PGandE.cpp) Consider a gas and electric bill that sets
two levels of use as follows:
Gas
10.1 therms
Electric
558 kwh
Tier 1 quantities
Tier 1 price
Tier 2 Price
$1.415 /therm
$1.932 /therm
Write a program that takes starting and ending readings
for gas and electric meters and calculates charges to the
nearest cent. Use one function to calculate charges for both
gas and electric so as to eliminate duplicate calculations.
$.223 /kwh
$.281 /kwh
Transcribed Image Text:8: PGandE.cpp) Consider a gas and electric bill that sets two levels of use as follows: Gas 10.1 therms Electric 558 kwh Tier 1 quantities Tier 1 price Tier 2 Price $1.415 /therm $1.932 /therm Write a program that takes starting and ending readings for gas and electric meters and calculates charges to the nearest cent. Use one function to calculate charges for both gas and electric so as to eliminate duplicate calculations. $.223 /kwh $.281 /kwh
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Introduction to Coding
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning