Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write a C++ program that calculates the monthly fee for the film system that rents different types of films. In your program, Create a
Write a C++ program that calculates the monthly fee for the film system that rents different types of films. In your program, Create a class called Film containing the following data members: name (string) type (string) film_registration_fee (double): the monthly fee of the system and the following member functions: getName(): returns the name of the film. setFee(): sets the daily fee of the film.. getType(): returns the type of the film. getFee(): returns the monthly fee of the film rent. add(): if the user enters 'a' for adding the film to the system, call this function in the main and add the film. A friend function named calculateMonthlyFee (Film f). This function first sets the daily rental fee for each film. If the film type is "Animation" the daily fee is 11.0; if the film type is "Action" the daily fee is 17.0. Otherwise, the fee is equal to 15.0. Then, this function calculates the monthly fee by multiplying the fee by 30. The calculated monthly fee is then returned. The Film class also has a constructor that receives two parameters to initialize the film name and type of the film. (Hint: You should use the setFee() function to set the film fee in the calculateMonthlyFee function.) In the main function, Create an array of objects from the Film class. (the size can be two) Your program should ask the user to enter the selection type: (a) for adding film to the system or (w) for watching the film from the system, or the user can cancel the system by entering (C). > If the user enters (a), add the film to your archive by using the add() function. If the user enters (w), the number of the movie will be entered, accordingly, your program will get the name and type of the movie, and type of the movie, and calculate the fee using the friend function calculateMonthlyFee(Film f). If the user enters (C), print out "Exit the program". Consider the sample runs given below. Sample Run 1: Do you want to add or watch a film (a/w), or enter (C) for exit the system: a Enter the name of the film to be added: Witcher The film name: Witcher is added. Enter the type: Animation The type of the film: Animation Enter the name of the film to be added: Leon The film name: Leon is added. Enter the type: Action The type of the film: Action Do you want to add or watch a film (a/w), or enter (C) for exit the system: w Enter the number of films: 1 Enter 1 film names: Enter the name of the movie: Leon Enter the type of the movie: Action You've watched film, and type of the film is Action Film Archive Fee Details: Monthly rent fee: 510 TL Do you wa to add or watch a film (a/w), or enter (C) for exit the system: C Exit the system. Sample Run 2: Do you want to add or watch a film (a/w), or enter (C) for exit the system:w Enter the number of films: 2 Enter 2 film names: Enter the name of the movie: ToyStory Enter the type of the movie: Animation You've watched film, and type of the film is Animation Film Archive Fee Details: Monthly rent fee: 330 TL Enter the name of the movie: Avatar Enter the type of the movie: Sci-Fi You've watched film, and type of the film is Sci-Fi Film Archive Fee Details: Monthly rent fee: 450TL Do you want to add or watch a film (a/w), or enter (C) for exit the system: C Exit the system.
Step by Step Solution
★★★★★
3.43 Rating (156 Votes )
There are 3 Steps involved in it
Step: 1
include include class Film private stdstring name stdstring type double filmregistrationfee public F...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started