Create a Program
You will create a program that displays amount of a cable bill. The Amount is based on the type of customer, as shown in the figure. For a residential customer, the user will need to enter the number of premium channels only. For a business customer, the user will need to enter the number of connections and the number of premium channels. Also enter appropraite comments and any additional instructions in your c++ program. Test the program appropriately before submission.
#include <iostream>
using namespace std;
int main() {
int customerType;//customer type:
//select customer type
cout<<"1. Residential customer\n";
cout<<"2. Business customer\n";
cout<<"Select customer type: ";
cin>>customerType;
int numberPremiumChannels;//the number of premium channels
int numberConnections=0;//the number of connections
float amountCableBill=0;
if(customerType==1){
cout<<"Enter the number of premium channels: ";
cin>>numberPremiumChannels;
amountCableBill=numberPremiumChannels*5;
}else if(customerType==2){
cout<<"Enter the number of connections: ";
cin>>numberConnections;
cout<<"Enter the number of premium channels: ";
cin>>numberPremiumChannels;
amountCableBill=numberPremiumChannels*5+numberPremiumChannels*5;
}else{
cout<<"\nWrong customer type\n\n";
}
//display Amount of a cable bill
cout<<"Amount of a cable bill = "<<amountCableBill<<"\n\n";
cin>>customerType;
return 0;
}
Comments
Leave a comment