1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
weeeeeb [17]
3 years ago
8

Write a function to prompt the user to enter the information for one movie (title, release date, mpaa rating and number of stars

). This function should then return the movie information back to main. You should call this function twice, once for each of the MovieInfo variables in main.

Computers and Technology
1 answer:
allsm [11]3 years ago
4 0

Answer:

Complete code is given and the output is attached also

Explanation:

#include <iostream>

#include <iomanip>

#include <list>

#include <iterator>

using namespace std;

/*

1. You will need to create a structure named MovieInfo that contains the following information about a movie:

title (string) - title of the movie

release date (string)

mpaa rating (string) - G, PG13, PG, R, NC17

number of stars (double) - out of 5

*/

struct MovieInfo

{

string title; //- title of the movie

string releaseDate ; //

string mpaaRating; // rating - G, PG13, PG, R, NC17

double numberOfStars; // of stars (1 out of 5)

};

/*

3. Write a function to prompt the user to enter the information for one movie (title, release date, mpaa rating and number of stars). This function should then return the movie information back to main. You should call this function twice, once for each of the MovieInfo variables in main.

Note: After you read the number of stars, you will need to use cin.get() or cin.ignore() to get rid of the end of line character prior to the next call to getline in your program

cout << "Enter the number of stars the movie received : ";

cin >> movie.numberOfStars;

cin.get();

*/

MovieInfo promptForMovieInformationAndReturn(){

MovieInfo movie;

cout<<"Enter the title of movie : ";

getline (cin,movie.title);

cout<<"Enter the release date of movie : ";

getline (cin,movie.releaseDate);

cout<<"Enter the mpaa rating of movie : ";

getline (cin,movie.mpaaRating);

cout << "Enter the number of stars the movie received : ";

cin >> movie.numberOfStars;

cin.get();

cout<<endl;

return movie;

}

/*

4. Write a function to display a list of movie recommendations that contains only the movies with 4 or more stars. The list of recommendations should include:

a title - Movie Recommendations

movie name

number of stars (formatted so you have 1 place after the decimal point)

You will need to use an if .. else if statement to display either both movies, one movie, or a message that you have no recommendations.

*/

void displayListOfMovieRecommendations(list<MovieInfo> movies){

list <MovieInfo> :: iterator it;

cout<<setw(16)<<left<<"*******************************"<<endl;

cout<<setw(16)<<left<<" Movie Recommendations "<<endl;

cout<<setw(16)<<left<<"*******************************"<<endl;

for(it = movies.begin(); it != movies.end(); ++it) {

if(it->numberOfStars >= 4 ){

cout <<setw(16)<<left<< it->title<<setw(16)<<left<<setprecision(2)<< it-> numberOfStars <<endl;

}

}

}

int main() {

/*

2. The main program will create two MovieInfo variables, for example movie1 and movie2.

*/

MovieInfo movie1;

MovieInfo movie2;

movie1 = promptForMovieInformationAndReturn();

movie2 = promptForMovieInformationAndReturn();

list <MovieInfo> movies;

movies.push_back(movie1);

movies.push_back(movie2);

displayListOfMovieRecommendations(movies);

}

You might be interested in
True or false?
Fed [463]

Answer:

True

Explanation:

Storing gathered multimedia files for an instructional video in a single folder is good practice because this method makes it easier for the user to access and manage the files. The files can also be easily transferred if there is need to since everything is stored in one central area.

Keeping a record of the source information is also important as this helps the instructor to control files and have quick access to any of the files.

4 0
4 years ago
PLEASE HELP there are TWO ANSWERS
pickupchik [31]

Answer:

Pero un campo cuyo tipo de datos es Número solo puede almacenar datos numéricos. ... Por ejemplo, los valores que se almacenan en un campo Texto solo pueden contener ... Para más información, haga clic en los tipos de datos siguientes. ... Controla la conversión de frases en las versiones asiáticas de Windows.

5 0
3 years ago
In the U.S. a standard mortgage requires a down payment of
Doss [256]
Atleast a minimum of 3%. Brainliest? 
6 0
4 years ago
Which design principle indicates that a project is visually satisfying
joja [24]

Answer: harmony

Explanation:

Took the test on gmetrix ;)

6 0
3 years ago
Do you think that distributed OSs use a process-communication technique different from that used by desktop OSs?
Lady_Fox [76]

Answer: Yes

Explanation: A distributed operating system use a technique to comunicate across all the nodes that were connected to it while the communication maded by a desktop operating system is directly with the system itself, we can use a distributed operating system to get connected through various desktop operating system.

3 0
4 years ago
Other questions:
  • For what show did the actor, whose star is located at 6667 Hollywood Boulevard, earn an Emmy Award for Outstanding Supporting Ac
    10·2 answers
  • A user would like to format an arrow that has been inserted into a chart. What is the most efficient method for completing this
    9·1 answer
  • Technician A says one disadvantage of fiber optic cables is that they are more expensive and very heavy. Technician B says one d
    6·1 answer
  • What are indexes in a database?
    14·1 answer
  • A developer needs to create a visualforce page that displays case data. The page will be used by both support reps and support m
    10·1 answer
  • Convert the ProjectedRaises class to an interactive application named ProjectedRaisesInteractive. Instead of assigning values to
    15·1 answer
  • You install a new driver, but your device still doesn't work. What is the first thing you should do?
    14·1 answer
  • g write a recursive function that prints out all the even numbers between x and y inclusive if x is odd then the print out will
    5·1 answer
  • Complete a flowchart and a Python program to calculate grade of a student based on marks using the following criteria:
    6·1 answer
  • Computers that communicate over a network must follow certain ___ to ensure that the transmission is sent properly and understoo
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!