Please Provide the C++ Code for Visual 2017 Cable Monthly Premium Assist Time Wa
ID: 3889642 • Letter: P
Question
Please Provide the C++ Code for Visual 2017
Cable Monthly Premium Assist
Time Warner needs a new program that will allow their agents to quickly calculate monthly premium of cable customers.
Requirement #1
We have 3 plans from which user can pick?
Basic $14.99 – 20 Channels
Essential $29.99 – 40 Channels
Premium $39.99 – 60 Channels
Requirement # 2
Sports Package is extra, an if user chooses the cost is $15.99 a month Extra.
Requirement # 3
HBO is also extra; the cost is $19.99.
Requirement # 4
Ask user how many cable box they need. We charge 9.99 per box per month.
Explanation / Answer
In order to run this code, create visual c++ project in visual studio then create a .cpp file and use this code.
#include <iostream>
using namespace std;
int main()
{
//required variables
int base,no_of_box;
char sports_pack,hbo;
double total=0.0;
//Display menu screen with options
cout<<"Cable monthly premium calculator "<<endl;
cout<<"Enter number for monthly base plan "<<endl;
cout<<"1. Basic $14.99 – 20 Channels "<<endl;
cout<<"2 Essential $29.99 – 40 Channels "<<endl;
cout<<"3 Premium $39.99 – 60 Channels "<<endl;
cin>>base;
switch(base)
{
case 1:
total= total + 14.99;
break;
case 2:
total= total + 29.99;
break;
case 3:
total =total + 39.99;
break;
default:
cout<<"invalid choice "<<endl;
return -1;
}
//select sports pack
cout<<"To add sport pack enter 'y' or 'n' "<<endl;
cin>>sports_pack;
if(sports_pack=='y')
total=total+15.99;
//select HBO
cout<<"To add HBO enter 'y' or 'n' "<<endl;
cin>>hbo;
if(hbo=='y')
total = total +19.99;
//select number of box
cout<<"Enter number of cable box needed "<<endl;
cin>>no_of_box;
total=total + (no_of_box*9.99);
//Print total monthly premium
cout<<"Total monthly premium: $"<<total<<endl;
return 1;
}