Question

In: Computer Science

You will be writing a program to calculate the cost of an online movie order. Write...

You will be writing a program to calculate the cost of an online movie order.

Write a program that calculates and prints the cost of viewing something through the CNR Cable Company’s on demand. The company offers three levels of viewing: TV, Movies that are New Releases and Movies (not considered new releases). Its rates vary depending on what is to be viewed.

The rates are computed as follows:

TV: Free

New Releases: 6.99

Movies (not new releases): The cost is based on the year the movie was released before 1960: 2.99 1960 – 1979: 3.99 1980 – 1999: 4.99 after 2000: 5.99

Your program should prompt the user to enter the title of the item to be viewed (string) and a type of viewing code (type char). A type code of t or T means TV; a type code of n or N means new release; a type code of m or M means a non-new release Movie. Treat any other character as an error. Your program should output the title, type of viewing, and the amount due from the viewer, formatted neatly. When printing the type of viewing you must print the description (i.e. New Release) NOT the code (i.e. n). For the non-new release movies, the customer must give the year the movie was released. Therefore, to calculate the bill, you must ask the user to input the year. The program MUST utilize functions and MUST contain at least one if statement and at least one switch statement. Functions should be written for the following tasks:  Output instructions  Prompt for and accept the movie name  Prompt for and accept the movie type (single character code)  Calculate the charge  Output the movie name, type description, and total charge

Solutions

Expert Solution

please please thumbs up!!!

hope it will help uh out!!!

Code::

(IN C++ PROGRAMMING LANGUAGE)

------------------------------------------------------

#include <iostream>
using namespace std;

double cost(int year)
{
double c;
if(year < 1960)
c = 2.99;
else if(year >=1960 && year <=1979)
c = 3.99;
else if(year >= 1980 && year <= 1999)
c = 4.99;
else if(year >= 2000)
c = 5.99;
return c;
}
int main() {

string title;
char code;
int year;

cout<<"Enter the title of the item to be viewed : ";
getline(cin,title); //to display the string in console
cout<<"\nEnter the Code of viewing : ";
cin>>code;
switch(code)
{
case 't':
case 'T': cout<<"\nTV : cost = $0";
break;
case 'n':
case 'N':cout<<"\nNew Releases : cost = $6.99";
break;
case 'm':
case 'M': cout<<"\nEnter the year of release : ";
cin>>year;
cout<<title;
cout<<"\nNot New Releases";
cout<<"\nCost $"<<cost(year); //function call
break;
default : cout<<"\nInvalid code ";
break;
}
return 0;
}
----------------------------------------------------------------

output::


Related Solutions

Write a program that will calculate the cost of installing fiber optic cable at a cost...
Write a program that will calculate the cost of installing fiber optic cable at a cost of .87 per ft for a company. Your program should display the company name and the total cost. Display a welcome message for your program. Get the company name from the user Get the number of feet of fiber optic to be installed from the user Multiply the total cost as the number of feet times .87. Display the calculated information and company name.
This week you will write a program that mimics an online shopping cart . You will...
This week you will write a program that mimics an online shopping cart . You will use all the programming techniques we have learned thus far this semester, including if statements, loops, lists and functions. It should include all of the following: The basics - Add items to a cart until the user says "done" and then print out a list of items in the cart and a total price. - Ensure the user types in numbers for quantities -...
(Write a program in C++) A local instructor wants you to write a program to calculate...
(Write a program in C++) A local instructor wants you to write a program to calculate the average score made on exams by her students. For simplicity, she always has only 12 students in each course she teaches. She teaches multiple subjects so she would like to enter the name of the exam. She wants the program to also determine the highest and lowest scores and the number of students who passed and failed the exam. A score of 60...
Write a program that will calculate and display the cost of a gasoline purchase based on...
Write a program that will calculate and display the cost of a gasoline purchase based on the brand of gasoline, the octane rating and the amount purchased. Your program should first display a menu prompting the user for the brand of gasoline.  Next prompt the user for the amount of gasoline in liters. Finally, your program should calculate and display the cost of the gasoline purchase using the formula below. Cost of Discount Gasoline = ($2.49 - (100 - Octane Rating)...
write this program in java... don't forget to put comments. You are writing code for a...
write this program in java... don't forget to put comments. You are writing code for a calendar app, and need to determine the end time of a meeting. Write a method that takes a String for a time in H:MM or HH:MM format (the program must accept times that look like 9:21, 10:52, and 09:35) and prints the time 25 minutes later. For example, if the user enters 9:21 the method should output 9:46 and if the user enters 10:52...
Write a Java program in Eclipse to calculate the total cost to enter into a waterpark...
Write a Java program in Eclipse to calculate the total cost to enter into a waterpark for a family/group Ticket rates are listed below kids (Age 12 and under)=$ 12.50 Regular( Age between12 -55) =$ 18.25 Seniors (55 and above) = $15.00 Tax =7% Your program should ask the user to enter the total number of members in their group. User needs to enter the ages for all members. Write appropriate error messages for invalid entries. An array should be...
Python This week you will write a program in Python that mimics an online shopping cart...
Python This week you will write a program in Python that mimics an online shopping cart . You will use all the programming techniques we have learned thus far this semester, including if statements, loops, lists and functions. It should include all of the following: The basics - Add items to a cart until the user says "done" and then print out a list of items in the cart and a total price. - Ensure the user types in numbers...
Python This week you will write a program in Pyhton that mimics an online shopping cart...
Python This week you will write a program in Pyhton that mimics an online shopping cart . You will use all the programming techniques we have learned thus far this semester, including if statements, loops, lists and functions. It should include all of the following: The basics - Add items to a cart until the user says "done" and then print out a list of items in the cart and a total price. - Ensure the user types in numbers...
write a report about travel agency in c++ not a program writing just report writing
write a report about travel agency in c++ not a program writing just report writing
JAVA Lab 9: Phone Call Write a program that will calculate the cost of a phone...
JAVA Lab 9: Phone Call Write a program that will calculate the cost of a phone call as follows: The first 10 minutes are charged at a flat rate of $0.99 (Not 99 cents a minute - but 99 cents for the first 10 minutes or less). This means that a phone call of 1 minute or 6 minutes or 10 minutes will be charged the same flat rate of 99 cents. Every minute after the initial 10 minutes will...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT