Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

C++ Movie data help please 1. Movie Data Write a program that uses a structure n

ID: 3841884 • Letter: C

Question

C++ Movie data help please

1. Movie Data

Write a program that uses a structure named MovieData to store the following information about a movie:

Title
Director
Year Released
Running Time (in minutes)

The program should create two MovieData variables, store values in their members, and pass each one, in turn, to a function that displays the information about the movie in a clearly formatted manner.

2. Movie Profit

Modify the Movie Data program written for Programming Challenge 1 to include two additional members that hold the movie’s production costs and first-year revenues. Modify the function that displays the movie data to display the title, director, release year, running time, and first year’s profit or loss.

I just need one program (The modified Version) that can give me the final product requested in problem 2

It should only use the followong classes

<iostream>

<string>

<iomanip>

Explanation / Answer

Below is the c++ program (cmments added):

#include <iostream>
#include <string>
#include <iomanip>


using namespace std;

//defining a structure movie data with the specified fields.
struct movie_data{
string title ;
string director ;
int year_released;
int running_time;
float first_year_profit;
float loss;
};


//function that displays the data stored in movie_data varaible
void display_data(struct movie_data data){
cout << "Movie Title : " << data.title << endl ;
cout << "Movie Director : " << data.director << endl ;
cout << "Movie Released Year : " << data.year_released << endl ;
cout << "Movie Running Time : " << data.running_time << endl ;
cout << "Movie First Year Profit : " << data.first_year_profit << endl ;
cout << "Movie Loss : " << data.loss << endl ;
}

int main(){
//declaring the variables of movie_data.
struct movie_data movie1 ;
struct movie_data movie2 ;


//initializing the fields with values.

movie1.title = "Titanic";
movie1.director = "James Cameron";
movie1.year_released = 1997;
movie1.running_time = 175;
movie1.first_year_profit = 343.6 ;
movie1.loss = 0;

movie2.title = "Inception";
movie2.director = "Christopher Nolan";
movie2.year_released = 2010;
movie2.running_time = 168;
movie2.first_year_profit = 0 ;
movie2.loss = 25;


//calling the function to display the data.
display_data(movie1);
cout << "***************************************************************" << endl;
display_data(movie2);

return 1;

}

OUTPUT :

Movie Title : Titanic
Movie Director : James Cameron
Movie Released Year : 1997
Movie Running Time : 175
Movie First Year Profit : 343.6
Movie Loss : 0
***************************************************************
Movie Title : Inception
Movie Director : Christopher Nolan
Movie Released Year : 2010
Movie Running Time : 168
Movie First Year Profit : 0
Movie Loss : 25

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at drjack9650@gmail.com
Chat Now And Get Quote