// ********************************************************************// This program will tabulate someones cellular phone bill according // to their service plan, number of minutes used based on pre-set// rates and fees for two types of plans.// Header files to include for data manipulation#include <iostream>#include <iomanip>#include <string>using namespace std;// Regular plan constantsconst double regFee = 10.00;// Included minutes, Overage Chargeconst int regIncluded = 50;const double regOverage = 0.20;// Premium plan constantsconst double premFee = 25.00;// Included minutes, Overage Charge - Dayconst int premDayIncl = 75;const double premDayOverage = 0.10;// Included minutes, Overage Charge - Nightconst 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; // 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: "; 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: "; cin >> service; // If statement to deal with the bill for users who are on the // "Regular" plan if (service == 'r' || service == 'R') { plan = "Regular"; // Get number of minutes used 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 > regIncluded) billTotal = regFee + ((totalMin - regIncluded) * regOverage); // Else, they only only owe the standard rate for Regular service. else billTotal = regFee; // If statement to handle bill for users who are on the // "Premium" plan } else if (service == 'p' || service == 'P') { plan = "Premium"; // Get number of day time minutes cout << "Please input the number of day time minutes you" << " have used this month: "; cin >> dayMin; // Get number of night time minutes cout << "\nPlease input the number of night time minutes" << " you have used this month: "; cin >> nightMin; cout << endl << endl; // Did the user exceed both day and night time minutes? if (dayMin > premDayIncl && nightMin > premNightIncl) billTotal = premFee + ((dayMin - premDayIncl) * premDayOverage) + ((nightMin - premNightIncl) * premNightOverage); // Did user exceed day minutes, but not night? else if (dayMin > premDayIncl && nightMin <= premNightIncl) billTotal = premFee + ((dayMin - premDayIncl) * premDayOverage); // Did user exceed night minutes, but not day? else if (dayMin <= premDayIncl && nightMin > premNightIncl) billTotal = premFee + ((nightMin - premNightIncl) * premNightOverage); // Else, they must have went over neither.. and only owe standard // rate for Premium service. else billTotal = premFee; // Else to handle invalid service types } else { cout << "Invalid service type!\n\n\n"; // End the program early to avoid errors with variables return 0; } // Output statement to handle cout << setfill(' '); cout << "Account #" << setw(20) << "Service Type" << setw(20) << "Minutes Used" << setw(14) << "Amount Due" << endl; cout << "---------------------------------------------------------------------" << "-----\n"; cout << account << setw(5) << " " << setw(15) << plan << " "; // Seperate if statement to determine whether to output premium or regular // plan minutes to the user. if (plan == "Premium") cout << setw(15) << dayMin + nightMin; else cout << setw(15) << totalMin; // One output statement cout << setw(15) << " $" << billTotal << endl << endl << endl; return 0;}