Question

In: Computer Science

In this exercise, you will create a program that displays the amount of a cable bill....

In this exercise, you will create a program that displays the amount of a cable bill. The amount is based on the type of customer, as shown in Figure 10-30. For a residential cus- tomer, 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. Use a separate void function for each customer type. If necessary, create a new project named Advanced23 Project, and save it in the Cpp8\ChaplO folder. Enter your C++ instructions into a source file named Advanced23.cpp. Also enter appropriate comments and any additional instructions required by the compiler. Test the program appropriately.

Residential customers:

Processing fee: $4.50

Basic service fee: $30

Premium channels: $5 per channel

Business customers:

Processing fee: $16.50

Basic service fee: $80 for the first 5 connections; $4 for each additional connection

Premium channels: $50 per channel for any number of connections

Solutions

Expert Solution

If you have any problem with the code feel free to comment.

Program

#include <iostream>

using namespace std;

void residentialCustomer();
void businessCustomer();

int main()
{
int choice;
//taking user choice
cout<<"1. Residential Customer"<<endl;
cout<<"2. Business Customer"<<endl;
cout<<"> ";
cin>>choice;
//calling the appropriate method according to user choice
if(choice==1)
residentialCustomer();
else if(choice==2)
businessCustomer();
else
cout<<"Invalid Choice";
}

void residentialCustomer()
{
int channels;
cout<<"Enter the number of premium channels: ";
cin>>channels;
double total = 4.50+30+(5*channels);//calculating resident fees
cout<<"Processing fee: $4.50"<<endl;
cout<<"Basic service fee: $30"<<endl;
cout<<"Premium channels: $5 per channel"<<endl;
cout<<"Total Cost: $"<<total<<endl;
}

void businessCustomer()
{
int channels, pChannels;

cout<<"Enter the number of channels: ";
cin>>channels;
cout<<"Enter the number of premium channels: ";
cin>>pChannels;

double total=0;
for(int i =1; i<=channels; i++)
{
//calculating normal channels total
if(i<=5)
total = i*80;
else
total = (i*80)+4;
}
total += 16.50+(50*pChannels);//calculating all total including premium channels

cout<<"Processing fee: $16.50"<<endl;
cout<<"Basic service fee: $80 for the first 5 connections; $4 for each additional connection"<<endl;
cout<<"Premium channels: $50 per channel "<<endl;
cout<<"Total Cost: $"<<total<<endl;

}

Output


Related Solutions

In this exercise, you will create a program that displays the amount of a cable bill....
In this exercise, you will create a program that displays the amount of a cable bill. The amount is based on the type of customer shown in figure 10-30. 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. Use a separate void function for each customer type. Enter your C++ instructions into the...
Create an application that calculates and displays the amount of a homeowner’s property tax. The tax...
Create an application that calculates and displays the amount of a homeowner’s property tax. The tax is 1.35% of the property’s assessed value, which will be entered by the user. a. Prepare a Planning Chart for the application. b. Draw a sketch of an appropriate interface. Be sure to follow the GUI design guidelines covered in the chapter. The guidelines are summarized in Figure 2-20. (If you want to include an image in the interface, you can either use your...
a.Create the logic for a program using pseudocode that calculates and displays the amount of money...
a.Create the logic for a program using pseudocode that calculates and displays the amount of money you would have if you invested $5000 at 2 percent simple interest for one year. Create a separate method to do the calculation and return the result to be displayed. b.Modify the program in Exercise 2a so that the main program prompts the user for the amount of money and passes it to the interest-calculating method. c.Modify the program in Exercise 2b so that...
In C, create a program that displays the minimum and maximum values stored in a data...
In C, create a program that displays the minimum and maximum values stored in a data file "datafile.txt". Use the following function prototype:  void minmaxarray(float value, float *min, float *max);
Create a program in JAVA that displays a design or picture for someone in your quarantine...
Create a program in JAVA that displays a design or picture for someone in your quarantine household/group: a pet, a parent, a sibling, a friend. Make them a picture using the tools in TurtleGraphics and run your program to share it with them! Use a pen object, as well as any of the shape class objects to help you create your design. You must use and draw at least 5 shape objects. - You must use a minimum of 4...
Chapter 8 Programming exercise 6 "Days of each month" Original Exercise: Design a program that displays...
Chapter 8 Programming exercise 6 "Days of each month" Original Exercise: Design a program that displays the number of days in each month. The program’s output should be similar to this: January has 31 days. February has 28 days. March has 31 days. April has 30 days. May has 31 days. June has 30 days. July has 31 days. August has 31 days. September has 30 days. October has 31 days. November has 30 days. December has 31 days. The...
This program will calculate the amount for a semester bill at The University of Nantucket. Part...
This program will calculate the amount for a semester bill at The University of Nantucket. Part 1: Create a class Course.java: The class has non-static instance variables: private String department private int courseNumber private int courseCredits private double courseCost The class must have a default constructor which will set values as follows: department = 0 courseNumber = 0 courseCost = 0 The class must a non-default constructor which will set values as follows: department = value passed to constructor courseNumber...
In this exercise, you create a program for the sales manager at Computer Haven, a small...
In this exercise, you create a program for the sales manager at Computer Haven, a small business that offers motivational seminars to local companies. Figure 7-53 shows the charge for attending a seminar. Notice that the charge per person depends on the number of people the company registers. For example, the cost for four registrants is $400; the cost for two registrants is $300. The program should allow the sales manager to enter the number of registrants for as many...
"Create a program that displays a table consisting of four rows and five columns. The first...
"Create a program that displays a table consisting of four rows and five columns. The first column should display the numbers 1 through 4. The second and sub-sequent columns should display the result of multiplying the number in the first column by the numbers 2 through 5. If necessary, create a new project named Introductory14 Project, and save it in the Cpp8\Chap08 folder. Enter the C++ instructions into a source file named Introductory14.cpp. Also enter appropriate comments and any additional...
Create a program that: Creates a sales receipt, displays the receipt entries and totals, and saves...
Create a program that: Creates a sales receipt, displays the receipt entries and totals, and saves the receipt entries to a file Prompt the user to enter the Item Name Item Quantity Item Price Display the item name, the quantity, and item price, and the extended price (Item Quantity multiplied by Item Price) after the entry is made Save the item name, quantity, item price, and extended price to a file When you create the file, prompt the user for...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT