need help in C++ Problem: You are asked to create a program for storing the catalog of movies at a DVD store using functions, files, and user-defined structures. The program should let the user read the movie through the file, add, remove, and output movies to the file. For this assignment, you must store the information about the movies in the catalog using a single vector. The vector's data type is a user-defined structure that you must define on functions.h following these rules: Identifier for the user-define structure: movie. Member variables of the structure "movie": name (string), year (int), and genre (string). Note: you must use the identifiers presented before when defining the user-defined structure. Your solution will NOT pass the unit test cases if you do not follow the instructions presented above. The main function is provided (you need to modify the code of the main function to call the user-defined functions described below). The following user-defined functions are provided in the functions.h template file printMenu: this function does not receive arguments and does not return a value. The function prints the options from the menu to STDOUT. Menu: A - Add Movie R - Remove Movie O - Output Movie Info C - Output Catalog Info R- Read file W- Write file Q - Quit Program printMovieInfo: this function receives the following arguments: A string representing the movie name. An integer representing the year of the movie. A string representing the movie genre. The function prints the information about a movie (name, year, and genre) and does not return a value. You must write the following user-defined functions: 1) printCatalog: this function receives the following arguments: -A vector with the catalog of movies. The function prints the information about each movie in the catalog using the output messages provided in the printMovieInfo function and does not return a value. 2) findMovie: this function receives the following arguments: A string representing the movie name. A vector with the catalog of movies. The function returns the index at which the movie name is located in the vector with the names of the movies in the catalog. If the movie is not in the catalog, the function must return -1.   3) addMovie: this function receives the following arguments: A string representing the name of the movie to be added to the catalog. An integer representing the year of the movie to be added to the catalog. A string representing the genre of the movie to be added to the catalog. A vector with the catalog of movies. The function adds the information about the new movie to the corresponding vectors and does not return a value. 4) removeMovie: this function receives the following arguments: A string representing the name of the movie to be removed from the catalog. A vector with the catalog of movies. If the movie is in the catalog, the function removes all the information about the movie from the vectors representing the catalog. The function returns true (boolean) if the movie was removed from the catalog or false (boolean) if the movie was not found.   5) movieInfo: this function receives the following arguments: A string representing the name of the movie to find in the catalog. A vector with the catalog of movies. If the movie is in the catalog, the function outputs the information about the movie using the output messages provided in the printMovieInfo function. If the movie is not found, then the function must print to STDOUT the following message: cout << "Cannot find " << /*movie name identifier*/ << endl; This function does not return a value.   6) readFromFile: this function receives the following arguments: A string with the input file name A vector with the catalog of movies The function reads the movie information from the input file and appends them to the Catalog. This function returns true (boolean) if the program can open the file specified by the first argument or false (boolean) if the program cannot open the file specified by the first argument. The information about the catalog of movies is stored in the input file using the following format: Movie Name 1 (string) Year1 (int) Genre1 (string) . . . Movie Name n (string) YearN (int) GenreN (string) Given the previous format for the input file (where each field of a movie is stored in one line), here is an example of an input file: Terminator 1984 Action The Goonies 1985 Fiction Avengers 2012 Action 7) writeToFile: this function receives the following arguments: A string with the name of the output file A vector with the catalog of movies The function stores the information from the movie catalog in the output file. This function returns true (boolean) if the program can open the file specified by the first argument or false (boolean) if the program cannot open the file specified by the first argument. You must save the information about the movie catalog using the format of an input file presented above (each field of a movie is stored in one line).

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

need help in C++

Problem:

You are asked to create a program for storing the catalog of movies at a DVD store using functions, files, and user-defined structures. The program should let the user read the movie through the file, add, remove, and output movies to the file.

For this assignment, you must store the information about the movies in the catalog using a single vector. The vector's data type is a user-defined structure that you must define on functions.h following these rules:

  • Identifier for the user-define structure: movie.
  • Member variables of the structure "movie": name (string), year (int), and genre (string).

Note: you must use the identifiers presented before when defining the user-defined structure. Your solution will NOT pass the unit test cases if you do not follow the instructions presented above.

The main function is provided (you need to modify the code of the main function to call the user-defined functions described below).

The following user-defined functions are provided in the functions.h template file

printMenu: this function does not receive arguments and does not return a value. The function prints the options from the menu to STDOUT.

Menu: A - Add Movie R - Remove Movie O - Output Movie Info C - Output Catalog Info R- Read file W- Write file Q - Quit Program

printMovieInfo: this function receives the following arguments:

A string representing the movie name. An integer representing the year of the movie. A string representing the movie genre.

The function prints the information about a movie (name, year, and genre) and does not return a value.

You must write the following user-defined functions:

1) printCatalog: this function receives the following arguments:

-A vector with the catalog of movies.

The function prints the information about each movie in the catalog using the output messages provided in the printMovieInfo function and does not return a value.

2) findMovie: this function receives the following arguments:

  • A string representing the movie name.
  • A vector with the catalog of movies.

The function returns the index at which the movie name is located in the vector with the names of the movies in the catalog. If the movie is not in the catalog, the function must return -1.

 

3) addMovie: this function receives the following arguments:

  • A string representing the name of the movie to be added to the catalog.
  • An integer representing the year of the movie to be added to the catalog.
  • A string representing the genre of the movie to be added to the catalog.
  • A vector with the catalog of movies.

The function adds the information about the new movie to the corresponding vectors and does not return a value.

4) removeMovie: this function receives the following arguments:

  • A string representing the name of the movie to be removed from the catalog.
  • A vector with the catalog of movies.

If the movie is in the catalog, the function removes all the information about the movie from the vectors representing the catalog. The function returns true (boolean) if the movie was removed from the catalog or false (boolean) if the movie was not found.

 

5) movieInfo: this function receives the following arguments:

  • A string representing the name of the movie to find in the catalog.
  • A vector with the catalog of movies.

If the movie is in the catalog, the function outputs the information about the movie using the output messages provided in the printMovieInfo function. If the movie is not found, then the function must print to STDOUT the following message:

cout << "Cannot find " << /*movie name identifier*/ << endl;

This function does not return a value.

 

6) readFromFile: this function receives the following arguments:

  • A string with the input file name
  • A vector with the catalog of movies

The function reads the movie information from the input file and appends them to the Catalog. This function returns true (boolean) if the program can open the file specified by the first argument or false (boolean) if the program cannot open the file specified by the first argument.

The information about the catalog of movies is stored in the input file using the following format:

Movie Name 1 (string) Year1 (int) Genre1 (string) . . . Movie Name n (string) YearN (int) GenreN (string)

Given the previous format for the input file (where each field of a movie is stored in one line), here is an example of an input file:

Terminator 1984 Action The Goonies 1985 Fiction Avengers 2012 Action

7) writeToFile: this function receives the following arguments:

  • A string with the name of the output file
  • A vector with the catalog of movies

The function stores the information from the movie catalog in the output file. This function returns true (boolean) if the program can open the file specified by the first argument or false (boolean) if the program cannot open the file specified by the first argument. You must save the information about the movie catalog using the format of an input file presented above (each field of a movie is stored in one line).

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 4 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY