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

Create a program in C++, Just one program, Please, that accomplishes the require

ID: 3841020 • Letter: C

Question

Create a program in C++, Just one program, Please, that accomplishes the requirements of problems 1 and 2.

A movie Data and Movie profits. thank you so much in advance, really stuck with this.

1. Movie Data Write a program that uses a structure named a to store the following infor- mation 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.

Explanation / Answer

#include <iostream>

using namespace std;

struct MovieData{
  
char *title;
char *director;
int year_released;
int running_time;
};

struct MovieProfit{
  
char *title;
char *director;
int year_released;
int running_time;
float pcost;
float revenue;
};

void display1(struct MovieData md);
void display2(struct MovieProfit mp);

int main()
{

   struct MovieData md1,md2;

   md1.title="Movie1";
   md1.director="Director1";
   md1.year_released=2014;
   md1.running_time=120;

   md2.title="Movie2";
   md2.director="Director2";
   md2.year_released=2015;
   md2.running_time=150;

   cout<<"Displaying 1st Member of Movie Data ";
   display1(md1);
   cout<<"Displaying 2nd Member of Movie Data ";
   display1(md2);


   struct MovieProfit mp;

   mp.title="Movie3";
   mp.director="Director3";
   mp.year_released=2016;
   mp.running_time=180;
   mp.pcost=1800.0f;
   mp.revenue=2000.0f;

   cout<<"Displaying Member of Movie Profit ";
   display2(mp);

   return 0;
}

void display1(struct MovieData md){
  
    cout<<"Title : "<<md.title<<" ";
    cout<<"Director : "<<md.director<<" ";
    cout<<"Year Released : "<<md.year_released<<" ";
    cout<<"Running Time : "<<md.running_time<<" ";
}

void display2(struct MovieProfit mp){
   
    cout<<"Title : "<<mp.title<<" ";
    cout<<"Director : "<<mp.director<<" ";
    cout<<"Year Released : "<<mp.year_released<<" ";
    cout<<"Running Time : "<<mp.running_time<<" ";
    cout<<"Production Cost: "<<mp.pcost<<" ";
    cout<<"Revenue : "<<mp.revenue<<" ";
  
    if((mp.revenue-mp.pcost) > 0){
      
        cout<<"Profit is "<<(mp.revenue-mp.pcost);
    }else{
      
        cout<<"Loss is "<<(mp.pcost-mp.revenue);  
    }

}

/*

      Ouput :-

      

*/

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