#include using namespace std; int main() { char day_p1,day_p2,again; int length, start_p1, start_p2, min_start, call_total, time_1, time_2, cost_1, cost_2, call_cost; // I am checking to see what day of the week it is. do { cout << "What day is it? Mo = Monday Tu = Tuesday We = Wednesday" << endl << "Th = Thursday Sa = Saturday Su = Sunday" << endl; cin >> day_p1 >> day_p2; switch (day_p1) { case 'M': case 'm': switch (day_p2) { // If it is Monday case 'O': case 'o': cout << " It is Monday." << endl; cout << " What time did you start your call? Enter in military time and press enter between hours and minutes." << endl; cin >> start_p1 >> start_p2; cout << " You entered " << start_p1 << start_p2 << " hundred hours." << endl; cout << "How long did it take to make the call?" << endl; cin >> length; cout << "You talked for " << length << " minutes." << endl; min_start = (length / 60) * 100 + length / 60; call_total = min_start + length; if (480 <= min_start <= 1080)// checking when the start time is in between 8 and 6. if (480 <= call_total <= 1080) { call_cost = .4 * length; cout << " The cost of the call is " << call_cost << "." << endl; } else { time_2 = call_total - 1080; cost_2 = time_2 *.25; time_1 = 1080 - min_start; cost_1 = time_1 *.4; call_total = cost_1 + cost_2; cout << " The cost of the call is " << call_cost << "." << endl; } else if ((min_start < 480) && (480 <= call_total <= 1080)) { time_2 = call_total - 480; cost_2 = .4 * time_2; time_1 = 480 - min_start; cost_1 = .25 * time_1; call_total = cost_1 + cost_2; cout << " The cost of the call is " << call_cost << "." << endl; } else if ((min_start < 480) && (call_total < 480)) { time_2 = 480 - call_total; cost_2 = .25 * time_2; time_1 = 480 - min_start; cost_1 = .25 * time_1; call_total = cost_1 + cost_2; cout << " The cost of the call is " << call_cost << "." << endl; } else if ((min_start < 480) && (1080 < call_total)) { time_2 = call_total - 1080; cost_2 = .25 * time_2; time_1 = 480 - min_start; cost_1 = .25 * time_1; call_total = cost_1 + cost_2; cout << " The cost of the call is " << call_cost << "." << endl; } else { call_total = .25 * length; cout << " The cost of the call is " << call_cost << "." << endl; } break; default: cout << "That is not a day." << endl; break; } break; case 'T': case 't': switch (day_p2) { case 'U': case 'u': cout << " It is Tuesday." << endl; cout << " What time did you start your call? Enter in military time and press enter between hours and minutes." << endl; cin >> start_p1 >> start_p2; cout << " You entered " << start_p1 << start_p2 << " hundred hours." << endl; cout << "How long did it take to make the call?" << endl; cin >> length; cout << "You talked for " << length << " minutes." << endl; min_start = (length / 60) * 100 + length / 60; call_total = min_start + length; if (480 <= min_start <= 1080) if (480 <= call_total <= 1080) { call_cost = .4 * length; cout << " The cost of the call is " << call_cost << "." << endl; } else { time_2 = call_total - 1080; cost_2 = time_2 *.25; time_1 = 1080 - min_start; cost_1 = time_1 *.4; call_total = cost_1 + cost_2; cout << " The cost of the call is " << call_cost << "." << endl; } else if ((min_start < 480) && (480 <= call_total <= 1080)) { time_2 = call_total - 480; cost_2 = .4 * time_2; time_1 = 480 - min_start; cost_1 = .25 * time_1; call_total = cost_1 + cost_2; cout << " The cost of the call is " << call_cost << "." << endl; } else if ((min_start < 480) && (call_total < 480)) { time_2 = 480 - call_total; cost_2 = .25 * time_2; time_1 = 480 - min_start; cost_1 = .25 * time_1; call_total = cost_1 + cost_2; cout << " The cost of the call is " << call_cost << "." << endl; } else if ((min_start < 480) && (1080 < call_total)) { time_2 = call_total - 1080; cost_2 = .25 * time_2; time_1 = 480 - min_start; cost_1 = .25 * time_1; call_total = cost_1 + cost_2; cout << " The cost of the call is " << call_cost << "." << endl; } else { call_total = .25 * length; cout << " The cost of the call is " << call_cost << "." << endl; } break; case 'H': case 'h': cout << "It is Thursday." << endl; cout << " What time did you start your call? Enter in military time and press enter between hours and minutes." << endl; cin >> start_p1 >> start_p2; cout << " You entered " << start_p1 << start_p2 << " hundred hours." << endl; cout << "How long did it take to make the call?" << endl; cin >> length; cout << "You talked for " << length << " minutes." << endl; min_start = (length / 60) * 100 + length / 60; call_total = min_start + length; if (480 <= min_start <= 1080) if (480 <= call_total <= 1080) { call_cost = .4 * length; cout << " The cost of the call is " << call_cost << "." << endl; } else { time_2 = call_total - 1080; cost_2 = time_2 *.25; time_1 = 1080 - min_start; cost_1 = time_1 *.4; call_total = cost_1 + cost_2; cout << " The cost of the call is " << call_cost << "." << endl; } else if ((min_start < 480) && (480 <= call_total <= 1080)) { time_2 = call_total - 480; cost_2 = .4 * time_2; time_1 = 480 - min_start; cost_1 = .25 * time_1; call_total = cost_1 + cost_2; cout << " The cost of the call is " << call_cost << "." << endl; } else if ((min_start < 480) && (call_total < 480)) { time_2 = 480 - call_total; cost_2 = .25 * time_2; time_1 = 480 - min_start; cost_1 = .25 * time_1; call_total = cost_1 + cost_2; cout << " The cost of the call is " << call_cost << "." << endl; } else if ((min_start < 480) && (1080 < call_total)) { time_2 = call_total - 1080; cost_2 = .25 * time_2; time_1 = 480 - min_start; cost_1 = .25 * time_1; call_total = cost_1 + cost_2; cout << " The cost of the call is " << call_cost << "." << endl; } else { call_total = .25 * length; cout << " The cost of the call is " << call_cost << "." << endl; } default: cout << "This is not a day." << endl; break; } break; case 'W': case 'w': switch (day_p2) { case 'E': case 'e': cout << "It is Wednesday." << endl; cout << " What time did you start your call? Enter in military time and press enter between hours and minutes." << endl; cin >> start_p1 >> start_p2; cout << " You entered " << start_p1 << start_p2 << " hundred hours." << endl; cout << "How long did it take to make the call?" << endl; cin >> length; cout << "You talked for " << length << " minutes." << endl; min_start = (length / 60) * 100 + length / 60; call_total = min_start + length; if (480 <= min_start <= 1080) if (480 <= call_total <= 1080) { call_cost = .4 * length; cout << " The cost of the call is " << call_cost << "." << endl; } else { time_2 = call_total - 1080; cost_2 = time_2 *.25; time_1 = 1080 - min_start; cost_1 = time_1 *.4; call_total = cost_1 + cost_2; cout << " The cost of the call is " << call_cost << "." << endl; } else if ((min_start < 480) && (480 <= call_total <= 1080)) { time_2 = call_total - 480; cost_2 = .4 * time_2; time_1 = 480 - min_start; cost_1 = .25 * time_1; call_total = cost_1 + cost_2; cout << " The cost of the call is " << call_cost << "." << endl; } else if ((min_start < 480) && (call_total < 480)) { time_2 = 480 - call_total; cost_2 = .25 * time_2; time_1 = 480 - min_start; cost_1 = .25 * time_1; call_total = cost_1 + cost_2; cout << " The cost of the call is " << call_cost << "." << endl; } else if ((min_start < 480) && (1080 < call_total)) { time_2 = call_total - 1080; cost_2 = .25 * time_2; time_1 = 480 - min_start; cost_1 = .25 * time_1; call_total = cost_1 + cost_2; cout << " The cost of the call is " << call_cost << "." << endl; } else { call_total = .25 * length; cout << " The cost of the call is " << call_cost << "." << endl; } break; default: cout << "This is not a day" << endl; break; } break; case 'F': case 'f': switch (day_p2) { case 'R': case 'r': cout << "It is Friday." << endl; cout << " What time did you start your call? Enter in military time and press enter between hours and minutes." << endl; cin >> start_p1 >> start_p2; cout << " You entered " << start_p1 << start_p2 << " hundred hours." << endl; cout << "How long did it take to make the call?" << endl; cin >> length; cout << "You talked for " << length << " minutes." << endl; min_start = (length / 60) * 100 + length / 60; call_total = min_start + length; if (480 <= min_start <= 1080) if (480 <= call_total <= 1080) { call_cost = .4 * length; cout << " The cost of the call is " << call_cost << "." << endl; } else { time_2 = call_total - 1080; cost_2 = time_2 *.25; time_1 = 1080 - min_start; cost_1 = time_1 *.4; call_total = cost_1 + cost_2; cout << " The cost of the call is " << call_cost << "." << endl; } else if ((min_start < 480) && (480 <= call_total <= 1080)) { time_2 = call_total - 480; cost_2 = .4 * time_2; time_1 = 480 - min_start; cost_1 = .25 * time_1; call_total = cost_1 + cost_2; cout << " The cost of the call is " << call_cost << "." << endl; } else if ((min_start < 480) && (call_total < 480)) { time_2 = 480 - call_total; cost_2 = .25 * time_2; time_1 = 480 - min_start; cost_1 = .25 * time_1; call_total = cost_1 + cost_2; cout << " The cost of the call is " << call_cost << "." << endl; } else if ((min_start < 480) && (1080 < call_total)) { time_2 = call_total - 1080; cost_2 = .25 * time_2; time_1 = 480 - min_start; cost_1 = .25 * time_1; call_total = cost_1 + cost_2; cout << " The cost of the call is " << call_cost << "." << endl; } else { call_total = .25 * length; cout << " The cost of the call is " << call_cost << "." << endl; } break; default: cout << "This is not a day." << endl; break; } break; case 'S': case 's': switch (day_p2) { case 'A': case'a': cout << " It is Saturday." << endl; cout << " What time did you start your call? Enter in military time and press enter between hours and minutes." << endl; cin >> start_p1 >> start_p2; cout << " You entered " << start_p1 << start_p2 << " hundred hours." << endl; cout << "How long did it take to make the call?" << endl; cin >> length; cout << "You talked for " << length << " minutes." << endl; min_start = (length / 60) * 100 + length / 60; call_total = min_start + length; call_cost = .15 * length; cout << " The cost of the call is " << call_cost << "." << endl; break; case 'U': case 'u': cout << " It is Sunday." << endl; cout << " What time did you start your call? Enter in military time and press enter between hours and minutes." << endl; cin >> start_p1 >> start_p2; cout << " You entered " << start_p1 << start_p2 << " hundred hours." << endl; cout << "How long did it take to make the call?" << endl; cin >> length; cout << "You talked for " << length << " minutes." << endl; min_start = (length / 60) * 100 + length / 60; call_total = min_start + length; call_cost = .15 * length; cout << " The cost of the call is " << call_cost << "." << endl; break; default: cout << "That is not a day." << endl; break; } break; default: cout << "That is not a day of the week." << endl; break; } cout << "Do you want to make another calculation? Y = Yes N = No" << endl; cin >> again; } while (again == 'Y' || again == 'y'); return 0; }