Write a C++program to estimate your water bill for next quarter. 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) •Integer number between 1 to 12 inclusive for the month of the year. •Type of residence (user to enter character as follows): S –Single-family Residence C –Condo A -Apartment 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 enters a negative number for the number of residents, output an error message and exit the program. If the month is entered out of range 1. . .12, 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 exit the program. CALCULATE Calculate the amount of bill. This calculation is to be completed in three separate functions each called from main(). FIRST CALCULATION FUNCTION to be called from main(). Calculate budget (water allocation) for people. Allow 50 gallons per person, per day (assume a 30 day month). So if 4 people: 8.02 =50*people*30/748=50*4*30/748 SECOND CALCULATION FUNCTION to be called from main(). Then calculate budget for outdoor landscape: Type of residence Month budget Single-family Residence 1, 2, 3, 4, 10, 11, 12 2.30 Single Family Residence 5, 6, 7, 8, 9 4.25 Condo 1, 2, 3, 4, 10, 11, 12 0.75 Condo 5, 6, 7, 8, 9 1.50 Apartment All months 0.00 THIRD CALCULATION FUNCTION to be called from main() Budget Total= Total allocated= budget for people + budget for landscape 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. OUTPUT Separate output function called from main() performs all output. A sample run might look like this: Sample Run Enter number of people in household: 4 Enter type of residence: ‘S’ for single family, ‘C’ for condo, or ‘A’ for apartment: s Enter Month: 3 Enter Actual CCF used: 12.0 Budget for peopleand landscape:10.32 Total cost: $ 25.14
Operations
In mathematics and computer science, an operation is an event that is carried out to satisfy a given task. Basic operations of a computer system are input, processing, output, storage, and control.
Basic Operators
An operator is a symbol that indicates an operation to be performed. We are familiar with operators in mathematics; operators used in computer programming are—in many ways—similar to mathematical operators.
Division Operator
We all learnt about division—and the division operator—in school. You probably know of both these symbols as representing division:
Modulus Operator
Modulus can be represented either as (mod or modulo) in computing operation. Modulus comes under arithmetic operations. Any number or variable which produces absolute value is modulus functionality. Magnitude of any function is totally changed by modulo operator as it changes even negative value to positive.
Operators
In the realm of programming, operators refer to the symbols that perform some function. They are tasked with instructing the compiler on the type of action that needs to be performed on the values passed as operands. Operators can be used in mathematical formulas and equations. In programming languages like Python, C, and Java, a variety of operators are defined.
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 3 images