Home / Questions / Write a C++ program that computes the cost of a long-distance call. The cost of the call is determin
Write a C++ program that computes the cost of a long-distance call.
The cost of the call is determined according to the following rate schedule:
a. Any call started between 8:00 A.M. and 6:00 P.M., Monday through Friday, is billed at a rate of $0.40 per minute.
b. Any call starting before 8:00 A.M. or after 6:00 P.M., Monday through Friday, is charged at a rate of $0.25 per minute.
c. Any call started on a Saturday or Sunday is charged at a rate of $0.15 per minute.
The input will consist of the day of the week, the time the call started, and the length of the call in minutes. The output will be the cost of the call. The time is to be input in 24-hour notation, so the time 1:30 P.M. is input as (must be the following format:)
13:30
The day of the week will be read as one of the following pairs of character values, which are stored in two variables of type char:
Mo Tu We Th Fr Sa Su
Be sure to allow the user to use either uppercase or lowercase letters or a combination of the two. The number of minutes will be input as a value of type int.
Format your output to two decimal places.
Define the following functions (value returning functions, Cally-by-Value):
validateUserInputTime(): validates the user's time input (hours and minutes should be positive numbers only including zero), and returns TRUE or FALSE.
validateUserInputDay(): validates the user's day input (only characters are allowed: Mo Tu We Th Fr Sa Su), and returns TRUE or FALSE. Allow uppercase and lowercase input.
validateUserInputCallLength(): validates the user's call length input (only positive integers are allowed), and returns TRUE or FALSE.
calculateTotalCost(): calculate the total cost of a call, and returns the total cost.
***Collect the user's inputs in the main() and pass them to the other functions.
***Allow the user to repeat the program.
***No object-oriented programming.
OUTPUTS:
**************************************************************************************
Enter the time the call starts in 24-hour rotation:
-13:10
Invalid time input.
Please try again.
Enter the time the call starts in 24-hour rotation:
**************************************************************************************
Enter the time the call starts in 24-hour rotation:
a:77
Invalid time input.
Please try again.
Enter the time the call starts in 24-hour rotation:
**************************************************************************************
Enter the time the call starts in 24-hour rotation:
13:10
Enter the first two letters of the day of the week:
ss
Invalid day input.
Please try again.
Enter the first two letters of the day of the week:
**************************************************************************************
Enter the time the call starts in 24-hour rotation:
13:10
Enter the first two letters of the day of the week:
1s
Invalid day input.
Please try again.
Enter the first two letters of the day of the week:
**************************************************************************************
Enter the time the call starts in 24-hour rotation:
13:10
Enter the first two letters of the day of the week:
Mo
Enter the length of the call in minutes:
-10
Invalid minute input.
Please try again.
Enter the length of the call in minutes:
**************************************************************************************
Enter the time the call starts in 24-hour rotation:
13:10
Enter the first two letters of the day of the week:
Mo
Enter the length of the call in minutes:
a1
Invalid minute input.
Please try again.
Enter the length of the call in minutes:
**************************************************************************************
Enter the time the call starts in 24-hour rotation:
13:10
Enter the first two letters of the day of the week:
Mo
Enter the length of the call in minutes:
10
Cost of the call: $4.00
Do you want to repeat the program?
y
**************************************************************************************
Enter the time the call starts in 24-hour rotation:
20:10
Enter the first two letters of the day of the week:
Fr
Enter the length of the call in minutes:
10
Cost of the call: $2.50
Do you want to repeat the program?
y
**************************************************************************************
Enter the time the call starts in 24-hour rotation:
10:10
Enter the first two letters of the day of the week:
Su
Enter the length of the call in minutes:
10
Cost of the call: $1.50
Do you want to repeat the program?
n
*************************************************************************************
Apr 02 2020 View more View Less
Which of the following is not true about government taxation?a.It is an indirect way to shift resources.b.It is free of opportunity costs.c.Taxes are levied on both ci...
Feb 11 2020Fool Proof Software is considering a new project whose data are shown below. The equipment that would be used has a 3-year tax life, and the allowed depreciation rates fo...
Jun 26 2021If at the current output of X the PX
Nov 10 2017In 1996, Congress offered national banks the opportunity to become Subchapter S entities. Amboy Bancorporation was a small, highly profitable New Jersey Bank that was ove...
Aug 15 2021What are product and factor markets?
Jun 08 2021A Saxonphone used by a professional band is that human resource, capital or natural resources?
Aug 23 2020Make a prediction based on a theoretical probability. Harriet rolls a number cube 39 times. How many times can she expect to roll 3 or 4?
May 10 2020A company manufactures three products using the same production process. The costs incurred up to the split-off point are $203,500. These costs are allocated to the produ...
Jun 01 2020How would net income be most likely to affect the accounting equationIncrease liabilities and decrease stockholder’s equityDecrease assets and decrease liabilitiesIncreas...
May 20 2021A private not-for-profit organization received a gift of $460,000 with purpose restrictions in 2013. In 2014 funds were expended for the purpose outlined in the gift, ho...
Jan 25 2020