Two parts, one problem. First part: 1. Movie Data Write a program that uses a st
ID: 3568999 • Letter: T
Question
Two parts, one problem. First part:
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 above 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.
JUST ONE PROGRAM, PLEASE, that accomplishes the requirements of problems 1 and 2.
You can initialize the structure in main, but then you must pass the structure to a function that displays the data in a clearly formatted manner.
Please and thank you!!!
Explanation / Answer
#include<stdio.h>
#include<stdio.h>
#include<time.h>
#include<iostream>
using namespace std;
struct MovieData{
char title[20];
char director[30];
int yearReleased;
int runningTime;
};
struct MovieProfit{
char title[20];
char director[30];
int yearReleased;
int runningTime;
double productionCost;
double firstYearRevenues;
};
void displayMovieData(struct MovieData m){
cout << "Title : " << m.title << endl;
cout << "Director : " << m.director << endl;
cout << "Year Released : " << m.yearReleased << endl;
cout << "Running Time : " << m.runningTime << endl;
cout << endl;
}
void displayMovieProfit(struct MovieProfit m){
cout << "Title : " << m.title << endl;
cout << "Director : " << m.director << endl;
cout << "Year Released : " << m.yearReleased << endl;
cout << "Running Time : " << m.runningTime << endl;
cout << "Production Cost : " << m.productionCost << endl;cout << "Title : " << m.title << endl;
cout << "Director : " << m.director << endl;
cout << "Year Released : " << m.yearReleased << endl;
cout << "Running Time : " << m.runningTime << endl;
cout << "First year's Profit : " << m.firstYearRevenues << endl;
cout << endl;
}
int main(){
MovieData m1 = {"Pulp Fiction", "Quentin Tarantino" , 1994 , 154};
MovieData m2 = {"The Godfather", "Francis Ford Coppola", 1972, 175};
displayMovieData(m1);
displayMovieData(m2);
MovieProfit m3 = {"Pulp Fiction", "Quentin Tarantino" , 1994 , 154, 200, 150};
MovieProfit m4 = {"The Godfather", " Francis Ford Coppola", 1972, 175, 300, 100};
displayMovieProfit(m3);
displayMovieProfit(m4);
return 0;
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.