// // This program will tabulate someones cellular phone bill according to their service plan, and number of minutes used. // Header files to include for data manipulation #include #include #include using namespace std; // Regular plan constants const double regFee = 10.00; const int regIncluded = 50; const double regOverage = 0.20; // Premium plan constants const double premFee = 25.00; const int premDayIncl = 75; const double premDayOverage = 0.20; const int premNightIncl = 100; const double premNightOverage = 0.05; int main() { // Declare character variables char service; // Declare integer variables int account, totalMin, dayMin, nightMin; // Declare double variables double billTotal, dayOverage, nightOverage; // Declare string variables string plan; // Perform formatting for output statements cout << showpoint << fixed << setprecision(2); // Prompt user for account number cout << "Please enter your account number: "; // Get input cin >> account; cout << endl; // Prompt user for type of service cout << "What type of service do you have?\n"; cout << "Enter [ R ] for Regular or [ P ] for Premium: "; // Get input cin >> service; switch (service) { case 'R': case 'r': plan = "regular"; cout << "Regular!\n\n"; break; case 'P': case 'p': plan = "premium"; cout << "Premium!\n\n"; break; default: cout << "Invalid service type!\n"; } // If statement to deal with the bill for users who are on the // "Regular" plan if (plan == "regular") { cout << "Please input the number of minutes you have used this month: "; cin >> totalMin; cout << endl << endl; // If they've used more than their 50 allowed minutes, determine bill cost // With overages included if (totalMin > 50) billTotal = regFee + ((totalMin - regIncluded) * regOverage); // Else, they only only owe the standard rate. else billTotal = regFee; cout << "Your total bill is: $" << billTotal << endl; } if (plan == "premium") { cout << "Please input the number of daytime minutes you have used this month: "; cin >> dayMin; cout << "\nPlease input the number of night time minutes you have used this month: "; cin >> nightMin; } return 0; }