Related questions with answers


A long-distance carrier charges the following rates for telephone calls between the United States and Mexico:

Starting Time of Call Rate per Minute
00:00-06:59 $0.12
07:00-19:00 0.55
19:01-23:59 0.35

Write a program that asks for the starting time and the number of minutes of the call, and displays the charges. The program should ask for the time to be entered as a floating-point number in the form HH.MM. For example, 07:00 hours should be entered as 07.00, and 16:28 hours should be entered as 16.28.

Hint: To find the fractional part of the entered number you can use the following expression:

startTime - static cast<int>(startTime)

Input Validation: Figure out what inputs are valid for startTime, and how the program will handle invalid inputs.


Step 1
1 of 5

Create an account to view solutions

Create an account to view solutions

More related questions