I am very new to C++ and have the slightest idea where to start. Here are the directions for the project I'm doing. Below is a copy of the program that I have so far.
An internet service provider has three different subscription packages for its customers:
Package A: For $9.95 per month 10 hours of access are provided. Additional hours are $2.00 per hour for 11-19 hours, $3.00 per hour for 20-50 hours and $4.00 per hour 51 or greater hours with maximum of 744 hours
Package B. For $14.95 per month 20 hours of access are provided. Additional hours are $1.00 per hour for 11-30 hours, $3.00 per hour for 31-75 hours and $4.00 per hour 76 or greater hours with maximum of 744 hours
Package C. For $19.95 per month unlimited access is provided.
Write a program that displays the menu above and use a switch case to calculate a customer’s monthly bill. The program will ask which package the customer has purchased and how many hours were used. It should then display the total amount due.
Input Validation: If user enters negative hours or enters a value other than A, B or C the program should display an error message and exit the program. If number of hours used in a month is greater than 744, display a message that the number hours used in a month cannot exceed 744.
#include <iostream>
using namespace std;
int main()
{
//declare constants and variables
double packageA = $9.95;
double packageB = $14.95;
double packageC = $19.95;
char pkg = ' ';
//enter input data
cout<<"Enter pkg: ";
cin>>pkg;
pkg = toupper(pkg);
if( pkg==A || pkg==B || pkg==C)
{
int hrs;
cout<<"Enter hours: ";
cin>>hrs;
if(hrs>=0 && hrs<=744)
{
int chg;
<strong class="highlight">switch</strong>(pkg)
{
case A:
chg = 9.95 + ( (hrs>10) ? (hrs-10)*2 : 0 );
break;
case:
{
if (hrs<=20)
chg= 14.95;
else if (hrs>20 && hrs <=50)
chg= 18+( (hrs>20 && hrs<=51) ? (hrs-20)*3 : 0 );
else if (hrs>51)
chg= 19.95;
break; }
case:
<strong class="highlight">3</strong>:
{
if (hrs<=200)
{
chg=25;
}
else if (hrs>200 && hrs<=450)
{
chg=35;
}
else if (hrs>450)
{
chg=50;
}
break;
}
default:
break;
}
cout<<"charges: "<<chg<<endl;
}
else
cout<<"Invalid hrs"<<endl;
}
else
{
cout<<"Invalid pkg"<<endl;
}
}//end main