I'm trying to write a code that calculates a cell phone bill. There are two different services: a regular service that is $10.00 and the first 50 minutes are free and charges over 50 minutes are $.20 per minute and the other a premium service that's $25 and the first 75 day minutes are free and any over that are $.10 and the first 100 night minutes are free and any over that are $.05. This is what I have so far and for some reason I keep getting errors and I'm not sure why. Also, I'm not sure where to calculate the night minutes over 100. Any ideas?
#include <iostream>
using namespace std;
const double rServiceCost = 10.00;
const double rPerMinuteCharge = .20;
const double pServiceCost = 25.00;
const double pDayPerMinuteCharge = .10;
const double pNightPerMinuteCharge = .05;
int main()
{
int minutes;
int dayMinutes;
int nightMinutes;
char serviceCode;
int accountNumber;
double amountDue;
cout << "Enter an account number: ";
cin >> accountNumber;
cout << endl;
cout << "Enter a service code: R or r (regular), P or p (premium): ";
cin >> serviceCode;
cout << endl;
switch (serviceCode)
{
case 'r':
case 'R': cout << "Enter the number of minutes used: ";
cin >> minutes;
cout << endl;
if (minutes > 50)
amountDue = rServiceCost + ((minutes - 50) * rPerMinuteCharge);
cout << "Account number = " << accountNumber << endl;
cout << "Amount Due = $" ,, amountDue << endl;
else
amountDue = rServiceCost;
break;
case 'p':
case 'P': cout << "Enter the number of day minutes used: ";
cin >> dayMinutes;
cout << endl;
cout << "Enter the number of night minutes used: ";
cin >> nightMinutes;
cout << endl;
if dayMinutes > 75
amountDue = pServiceCost + ((minutes - 75) *
pDayPerMinuteCharge);
else
amountDue = pServiceCost;
}
return 0;
}