![ladybugys](/avatars/33499.jpg)
ladybugys
01.02.2021 •
Computers and Technology
I need to create a movie database program in C++
the program needs to do the following:
1. Populate your dynamically-allocated array of Movie objects by reading in information from the file
2. Ask the user to enter a movie title and perform a noncase-sensitive search a. If the movie is found, display the movie’s information and ask the user if they would like to save the movie; if they choose yes, save the movie to favorites.txt b. If the movie is not found, display an error message
3. Ask the user if they would like to exit a. If they choose not to exit, prompt them for a new movie title and repeat the process b. If they want to exit, display all movies in favorites.txt
And the program needs to contain the following functions
1. int numberOfLines(ifstream&);
This function accepts an input file and returns an integer representing the number of lines in the file
2. void populateMovieFromFile(ifstream&, Movie&);
This function accepts an input file and a Movie object. Inside the function, a single line should be read in from the current read position of the input file. Once the line has been read in, it will be parsed and stored in the Movie object that was passed to the function. Notice that for a single call of populateMovieFromFile, only a single Movie object is populated. This means you will need to call it multiple times!
3. void displayMovie(const Movie&);
This function accepts a Movie object passed by constant reference and displays the contents of that object in a formatted fashion (see sample run).
4. Movie* createDatabase(int&);
As the name suggests, this function will be responsible for creating your movie database (which is just a dynamically-allocated array of Movie objects). The integer argument passed by reference to the function represents the number of movies in the database. It will not be initialized when you call the function, meaning its value will be set inside the body of the function. This function should:
First, prompt the user to enter an input file name. If the name is invalid, display an error and continue to prompt them until a valid file name has been entered.
Determine the number of lines in the file using the numberOfLines function and create your dynamically-allocated array of Movie objects.
Loop through your newly-created array and store a movie in each index. This is where you will want to call your handy populateMovieFromFile function.
Populate the reference argument and return a pointer to the array of Movie objects
5. bool caseInsensitiveCmp(string, string);
This function accepts two strings and performs a noncase-sensitive comparison on the two. If the two strings are the same, the function should return true; otherwise, it should return false. For example, if I pass the strings "skyfall" and "SKYFALL" to this function, it should return true.
6. void findMovie(Movie*, int);
This function accepts a pointer to an array of Movie objects (your database), and the number of Movies (which is the same thing as the number of elements in the array). The function should: First, prompt the user to enter a movie title to search for Search through the array of Movie objects for the movie title ○ If the movie was found, display the movie and ask the user if they would like to save the movie; if they choose yes, the movie will be saved to favorites.txt ○ If the movie was not found, display an error message Notice that this function only prompts the user for a single movie and only performs a single search. This means you will be using it in a loop!
7. void saveToFile(const Movie&);
This function accepts a Movie object, passed by constant reference. It should save the Movie object to the "favorites.txt" file. If the file does not exist, create it. If the file does exist, add the Movie object to the end of the file. Remember that you need to store the Movie object in the format: Movie title, Gross Total (in billions), Director, Release Date, Runtime (in minutes)
8. bool promptToContinue();
This function will determine whether or not the user wants to continue using the program. First, ask the user if they would like to exit the program and prompt them to either enter ‘Y’ or ‘N’. If ‘Y’ or ‘y’ is entered, the function will return false (the user no longer wishes to continue); otherwise, return true.
9. void displayFavorites();
This function will display all saved favorite movies by displaying all the information in the favorites.txt file. If there are no saved movies, display an error; otherwise, simply display all saved movies.
A complete example of a working program would be greatly appreciated.
Solved
Show answers
More tips
- S Style and Beauty Tricks and Tips: How to Get Rid of Freckles...
- H Health and Medicine How to perform artificial respiration?...
- C Computers and Internet How to Get Rid of Windows Genuine Check?...
- F Food and Cooking The Disease That Haunted Abraham Lincoln...
- S Style and Beauty How to Make Your Lips Fuller? Ideas and Tips for Beautiful Lips...
- S Style and Beauty How are artificial nails removed?...
- F Family and Home How to Sew Curtain Tapes: Best Tips from Professionals...
- H Horoscopes, Magic, Divination How to Cast a Love Spell on a Guy? Guide for Guys...
- F Family and Home How to Properly Use a Water Level?...
- L Legal consultation What Documents Are Required for a Russian Passport?...
Answers on questions: Computers and Technology
- C Computers and Technology Write a Python script that will calculate the value of a savings account after 10 years. Your script should prompt the user to enter a starting value and then calculate...
- C Computers and Technology Impaired drivers not only harm themselves but they harm other individuals and affect our daily commute vacation plans entire society dmv wait times me...
- C Computers and Technology Which of the following shows the assignment of a string to a variable? Select 3 optlons. o answer - 123 O answer : 23 answer = input( How old are you? ) answer -...
- C Computers and Technology Explain single entry and single-exit concept structured programming...
- M Mathematics Complete the following equivalent fractions....
- E English The following is an excerpt from a student s essay on renewable energy for her science class. Read the excerpt and answer the question that follows. I believe renewable...
- M Mathematics PLEASE HELP IM RUNNING OUT OF TIME AND ILL GIVE 15 POINTS...
- H History What effect did the creation of U.S.Steel have on the power of Pittsburgh steelworkers to change their jobs or working conditions?...
- M Mathematics 2X+6 5x-20 4x+2 Help please...
- M Mathematics Carli created a sculpture as shown in the diagram. The sculpture is 8 centimeters tall and the area of the bottom of the sculpture is 49 square inches. Which expression...
Ответ:
B. She can, but she may have to pay for it.
Explanation:
A credit report is a report that contains the credit history of an individual. A credit report is issued by Credit bureaus who have financial information of a person.
Credit bureaus issue one credit report for free every year. But if a person desires to issue a credit report more than once a year then he/she will have to pay a fee for it.
In the given scenario, Marina who has requested a copy of the credit report in May 2019, will have to pay a fee for a copy of the second credit report.
Therefore, option B is correct.