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
___operating space means there is a restriction to the drivers line of sight
Harman [31]

Answer

Closed zone operating space means there is a restriction to the drivers line of sight

Explanation

The line of sight restriction to a driver or while driving is the visible path of travel from your vehicle to your targeted area towards your destination.It is also the area that's visible to a driver while driving.

Closed zone or condition means that there is a restriction to the drivers view or that the space is unavailable in a particular zone.

5 0
3 years ago
Give examples of sound effects that can be used in a cartoon or computer game
vredina [299]
-Bubbles
-Explosion
-Pebbles
-Popping Balloon
--Hopping Noise
4 0
4 years ago
Lief wants to keep the information of his chart, but he doesn’t want it taking up space in his page. What should he select after
Murljashka [212]
If wants to keep the chart but does not want it taking up space, he can move it  to another sheet. Once he goes to the Move Chart tab, he should select New Sheet which will ask for a name of the new sheet. After doing this, the chart will be moved to a different sheet.
4 0
4 years ago
Read 2 more answers
True/False: Software engineering is a field that encompasses designing, writing, testing, debugging, documenting, modifying, and
Natali [406]

Answer:

The answer is "True".

Explanation:

The software engineering is the mechanism by which end-user programs are evaluated and planned, to built and reviewed, and fulfill these needs by using language software programming.

  • The fundamental goal of software engineering is to design software, that uses the techniques and processes, that are applied to make large systems and frequently used to produce quality applications.
  • It is also used in modifying and maintaining software.

7 0
3 years ago
5. What skill is unique to reading online?
torisob [31]
Ignoring distractions like hyperlinks and advertisements
6 0
3 years ago
Other questions:
  • The strength of the electromagnetic waves being radiated from an antenna is referred to as gain, which involves a measurement of
    9·1 answer
  • What is the definition of online communication
    15·1 answer
  • Renee's creating a plan for her business's information system. What should she do after she determines the goals for her busines
    10·1 answer
  • Please submit the following assignment prior to Sunday at 11:59 pm. Eastern time: 1. Using a Microsoft Word document, please dis
    11·1 answer
  • Which of the following statements is true?
    8·2 answers
  • You are creating a business report for your organization. Where will you find the options to edit the margins of your document?
    11·2 answers
  • The following code in a different program is not working properly.The message should display the value of the intCounter variabl
    11·1 answer
  • Suppose users share a 1-Gbps link. Also, suppose each user requires 200 Mbps when transmitting, but each user only transmits 30
    5·1 answer
  • Which type of wireless attack is designed to capture wireless transmissions coming from legitimate users
    6·1 answer
  • Void printInfo()
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!