demoneyejin
06-27-2010, 04:55 PM
(here's the actual thing, if it helps any)
A long-distance carrier charges the following rates for telephone calls:
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 ending time of the call in military format, and then calculates and displays the number of minutes and the charges of the call. The program should ask the user to enter the time as a floating-point number in the form HH.MM. For example, 07:00 hours will be entered as 07.00, and 16:28 hours will be entered as 16.28.
Example 1:
Starting Time: 18:50 Ending Time: 20:03 Duration: 73 mins. Charges: $40.15
Example 2:
Starting Time: 23:50 Ending Time: 00:17 Duration: 27 mins. Charges: $9.45
Input Validation
The program should check if: the starting time and the ending time are numbers. the starting time and the ending time are in military format. (i.e. 0 <= hrs <= 23 and 0 <=
mins <= 59)
If the input is not valid, then the program should display an appropriate error message and terminate immediately. For example, if the starting time is invalid, the program
should not prompt the user for the ending time of the call.
Requirements: Your program should follow the programming style guidelines discussed in class. In addition, it should
be well documented and use descriptive variable names. The name of the variable should reflect its purpose. Your program must use named constants where appropriate.
A long-distance carrier charges the following rates for telephone calls:
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 ending time of the call in military format, and then calculates and displays the number of minutes and the charges of the call. The program should ask the user to enter the time as a floating-point number in the form HH.MM. For example, 07:00 hours will be entered as 07.00, and 16:28 hours will be entered as 16.28.
Example 1:
Starting Time: 18:50 Ending Time: 20:03 Duration: 73 mins. Charges: $40.15
Example 2:
Starting Time: 23:50 Ending Time: 00:17 Duration: 27 mins. Charges: $9.45
Input Validation
The program should check if: the starting time and the ending time are numbers. the starting time and the ending time are in military format. (i.e. 0 <= hrs <= 23 and 0 <=
mins <= 59)
If the input is not valid, then the program should display an appropriate error message and terminate immediately. For example, if the starting time is invalid, the program
should not prompt the user for the ending time of the call.
Requirements: Your program should follow the programming style guidelines discussed in class. In addition, it should
be well documented and use descriptive variable names. The name of the variable should reflect its purpose. Your program must use named constants where appropriate.