THE PROGRAM SHOULD BE WRITTEN USING C++    Checkpoints    Absolutely no arrays or structures. The problem is designed to be solved using primitive types only: int, float, double, char. Use only pass by value. Also, ABSOLUTELY NO GLOBAL VARIABLE DECLARATIONS. All variables need to be declared in main() or another function. No loops for this lab. 1) Include name, e-mail, and lab# as comment and print same to output 2) Minimum of three (3) comments in each function     (Purpose: Pre: Post:) For how to write Pre/Post/Purpose watch the video and follow the model code posted on week 5 of Canvas: Code from Webinar - Training Heart Rate (Watch Video First). 3) Use a globally defined constant for the allotment per person, i.e. 50 gallons 4) Input may not be case sensitive. That is, if user enters ‘s’ change it to ‘S’ immediately. To do this use if() and assign uppercase value or you may use toupper() function (see 10.2 of text). Only an error message should be output and nothing more if data is erroneous. Use exit() function as explained in seciotn 6.15 of text 5) One function which must be called from main() to calculate the total budget. Use C++ Style with prototype before main() and the function definition after main(). 6) One function which must be called from main() to calculate the cost based on budget (calculated in previous function) and CCFs used. Use C++ Style with prototype before main() and the function definition after main(). 7) One function which must be called from main() to be used for all the output. Output must be formatted using 2 decimal places for all values and a dollar sign for the amount as shown in examples.

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter4: Selection Structures
Section4.3: Nested If Statements
Problem 7E
icon
Related questions
Question
  • THE PROGRAM SHOULD BE WRITTEN USING C++ 
  •  
  • Checkpoints    Absolutely no arrays or structures. The problem is designed to be solved using primitive types only: int, float, double, char. Use only pass by value. Also, ABSOLUTELY NO GLOBAL VARIABLE DECLARATIONS. All variables need to be declared in main() or another function. No loops for this lab.

1) Include name, e-mail, and lab# as comment and print same to output

2) Minimum of three (3) comments in each function     (Purpose: Pre: Post:) For how to write Pre/Post/Purpose watch the video and follow the model code posted on week 5 of Canvas: Code from Webinar - Training Heart Rate (Watch Video First).

3) Use a globally defined constant for the allotment per person, i.e. 50 gallons

4) Input may not be case sensitive. That is, if user enters ‘s’ change it to ‘S’ immediately. To do this use if() and assign uppercase value or you may use toupper() function (see 10.2 of text). Only an error message should be output and nothing more if data is erroneous. Use exit() function as explained in seciotn 6.15 of text

5) One function which must be called from main() to calculate the total budget. Use C++ Style with prototype before main() and the function definition after main().

6) One function which must be called from main() to calculate the cost based on budget (calculated in previous function) and CCFs used. Use C++ Style with prototype before main() and the function definition after main().

7) One function which must be called from main() to be used for all the output. Output must be formatted using 2 decimal places for all values and a dollar sign for the amount as shown in examples.

CALCULATE
Calculate the amount of bill. This calculation is to be completed in two separate
functions each called from main().
FIRST CALCULATION FUNCTION STEP 1:
Calculate budget for people. Allow 50 gallons per person, per day (assume a 30 day
month).
So if 4 people: 50*people*30/748 =50*4*30/748 = 8.02
FIRST CALCULATION FUNCTION STEP 2:
Calculate water budget for outdoor landscape:
Type of residence
Single-family Residence
Budget for outdoor Usage
2.30
Condo
0.75
Apartment
0.00
Budget Total = budget for people + budget for landscape = 8.02 + 2.30 = 10.32
SECOND CALCULATION FUNCTION
Calculate Cost as $1.65 per CCF used under or equal to their water budget and $4.83 per
CCF on amount water used above their water budget.
Transcribed Image Text:CALCULATE Calculate the amount of bill. This calculation is to be completed in two separate functions each called from main(). FIRST CALCULATION FUNCTION STEP 1: Calculate budget for people. Allow 50 gallons per person, per day (assume a 30 day month). So if 4 people: 50*people*30/748 =50*4*30/748 = 8.02 FIRST CALCULATION FUNCTION STEP 2: Calculate water budget for outdoor landscape: Type of residence Single-family Residence Budget for outdoor Usage 2.30 Condo 0.75 Apartment 0.00 Budget Total = budget for people + budget for landscape = 8.02 + 2.30 = 10.32 SECOND CALCULATION FUNCTION Calculate Cost as $1.65 per CCF used under or equal to their water budget and $4.83 per CCF on amount water used above their water budget.
Irvine Ranch Water District
Write a C++ program to estimate your water bill for next month. Your water meter
measures the volume of water you use in hundreds of cubic feet (CCF). One CCF of
water equals approximately 748 gallons.
INPUT
All input statements and their user prompts need to be in main() since pass by value only
is being used in this lab. Your program is to prompt the user for:
Number of residents in household (integer > 0)
Type of residence (user to enter character as follows):
S- Single-family Residence
C- Condo
A– Apartment
Acutual number of CCFS used.
Program should not be case-sensitive. That is if user enters a lowercase 's' your program
is to treat it as an uppercase S' either by using toupper() function or through 'if
statement.
If user eneters a negative number for the number of residents, output an error message
and exit the program. If letter other than s, S, c, C, a, or A is entered, output an error
message and end the program.
Transcribed Image Text:Irvine Ranch Water District Write a C++ program to estimate your water bill for next month. Your water meter measures the volume of water you use in hundreds of cubic feet (CCF). One CCF of water equals approximately 748 gallons. INPUT All input statements and their user prompts need to be in main() since pass by value only is being used in this lab. Your program is to prompt the user for: Number of residents in household (integer > 0) Type of residence (user to enter character as follows): S- Single-family Residence C- Condo A– Apartment Acutual number of CCFS used. Program should not be case-sensitive. That is if user enters a lowercase 's' your program is to treat it as an uppercase S' either by using toupper() function or through 'if statement. If user eneters a negative number for the number of residents, output an error message and exit the program. If letter other than s, S, c, C, a, or A is entered, output an error message and end the program.
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
Declaring and Defining the Function
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
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage