/* Computer Science & Programming Jason M. Snouffer Wednesday, October 2, 2002 Lab 5 Problem 5 This program recieves the day of the week, time a call was placed, and the length of the call, then calculates how much the call will cost. Input (day of week): Mo Input (time): 13:00 Input: (call duration): 24 Expected Output: Your call will cost $9.60 Input (day of week): tU Input (time): 1:00 Input: (call duration): 75 Expected Output: Your call will cost $18.75 Input (day of week): we Input (time): 18:00 Input: (call duration): 10 Expected Output: Your call will cost $2.50 Input (day of week): Th Input (time): 7/50 Input: (call duration): 100 Expected Output: Your call will cost $25.00 Input (day of week): fr Input (time): 8:00 Input: (call duration): 30 Expected Output: Your call will cost $12.00 Input (day of week): sA Input (time): 15:15 Input: (call duration): 47 Expected Output: Your call will cost $7.05 Input (day of week): su Input (time): 20:30 Input: (call duration): 1000 Expected Output: Your call will cost $150.00 Input (day of week): SU Input (time): 4;20 Input: (call duration): 75.7 Expected Output: Your call will cost $11.25 Input (day of week): Mu Expected Output: You entered an invalid day of the week! Input (day of week): SU Input (time): 15.2 Expected Output: Input (day of week): we Input (time): 4:20 Input: (call duration): a Expected Output: All of the sample inputs within this test suite were tested and performed as expected. */ #include #include using namespace std; int main () { int start_time_hours, start_time_minutes, call_length_minutes, cost_of_call, cost_in_dollars, cost_in_cents; const int COST_WEEKDAYS_INHOURS(40), COST_WEEKDAYS_OUTHOURS(25), COST_WEEKENDS(15); char colon, first_letter_of_day, second_letter_of_day; cout<<"Please enter the day of the week that the call is placed: \n" <<"(In the format of Mo Tu We Th Fr Sa Su): "; cin>>first_letter_of_day>>second_letter_of_day; cout<<"Please enter the time the call started (in 24-hr notation): "; cin>>start_time_hours>>colon>>start_time_minutes; cout<<"Please enter the length of the call (in minutes): "; cin>>call_length_minutes; if ( ( (first_letter_of_day =='M' || first_letter_of_day =='m') && (second_letter_of_day == 'O' || second_letter_of_day == 'o') ) || ( (first_letter_of_day =='T' || first_letter_of_day =='t') && (second_letter_of_day == 'U' || second_letter_of_day == 'u') ) || ( (first_letter_of_day =='W' || first_letter_of_day =='w') && (second_letter_of_day == 'e' || second_letter_of_day == 'E') ) || //These statements check for the day of the week ( (first_letter_of_day =='T' || first_letter_of_day =='t') && (second_letter_of_day == 'H' || second_letter_of_day == 'h') ) || ( (first_letter_of_day =='F' || first_letter_of_day =='f') && (second_letter_of_day == 'R' || second_letter_of_day == 'r') ) ) { if ( (start_time_hours >= 8) && (start_time_hours < 18) ) { cost_of_call = COST_WEEKDAYS_INHOURS * call_length_minutes; } else { cost_of_call = COST_WEEKDAYS_OUTHOURS * call_length_minutes; } } else if ( ( (first_letter_of_day =='S' || first_letter_of_day =='s') && (second_letter_of_day == 'A' || second_letter_of_day == 'a') ) || ( (first_letter_of_day =='S' || first_letter_of_day =='s') && (second_letter_of_day == 'U' || second_letter_of_day == 'u') ) ) { cost_of_call = COST_WEEKENDS * call_length_minutes; } else { cout<<"You entered an invalid day of the week!\n"; return EXIT_FAILURE; } cost_in_dollars = cost_of_call / 100; cost_in_cents = cost_of_call % 100; cout<<"Your call will cost $" <