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

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...
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...
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...
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...
"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...
Objective: Create a program that displays a design or picture for someone in your quarantine household/group:...
Objective: Create a program 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 different colors...
The average monthly cable bill in 2016 has been reported to be ​$92. Assume monthly cable...
The average monthly cable bill in 2016 has been reported to be ​$92. Assume monthly cable bills follow a normal distribution with a standard deviation of ​$9.50. a. What is the probability that a randomly selected bill will be 1. less than​ $90​? 2. less than ​$100​? 3. exactly ​$100​? 4. between ​$85 and ​$95​? Which monthly cable bill represents the 55th percentile?
JAVA Exercise BasketBall Bar Chart Write a program that allows you to create a bar chart...
JAVA Exercise BasketBall Bar Chart Write a program that allows you to create a bar chart for the active members of a basketball team during a game. (Recall: there are only 5 active players on the court per team in a standard basketball game.) Your program should do the following tasks: • Prompt the user to store the first name of the five players • Prompt the user to enter the points scored by each player a. Use a while...
Create a program that calculate the amount of a mortgage payment. Refer to the appropriate video...
Create a program that calculate the amount of a mortgage payment. Refer to the appropriate video or any online source for how the mathematics of the calculation works. If given these three things: The amount of the loan in whole dollars The number of payments (e.g. 360 for 30-year) The interest rate per payment period in percent ( a positive floating-point number) The program should print out the correct value (in dollars and cents) of the per-period payment of principal...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT