Question

C++Write a program that uses a class name MovieData to store the following information about a...

C++Write a program that uses a class name MovieData to store the following information about a movie:

create a class not a strcuture please.

Title

Director

Year release

Running time

Inclue a constructor that allows all four of these memberdata values to be sprcified at the time a MovieData variable is created

The program should create two MovieData variable. Do not use user input.

Have a stand alone function that displays the information about the movie in a clearly formatted manner. This function takes an object of type MovieData. It is not a method of MovieData.

0 0
Add a comment Improve this question Transcribed image text
Answer #1
#include<iostream>
#include<string>

using namespace std;

class MovieData 
{
    public:
    string Title;
    string Director;
    int Year;
    int Time;
    MovieData(string t, string d, int y, int ti){
       Title = t;
       Director = d;
       Year = y;
       Time = ti;
   }
    void display(){
       cout<<Title<<"\t"<<Director<<"\t"<<Year<<"\t"<<Time<<endl;
   }
};
 
 
int main(){
   MovieData* movieData1 = new MovieData("Title1","Director1",1,180);
   movieData1->display();
   
   MovieData* movieData2 = new MovieData("Title2","Director2",2,180);
   movieData2->display();
   
   return 0;
}

Add a comment
Know the answer?
Add Answer to:
C++Write a program that uses a class name MovieData to store the following information about a...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • write a C++ program that uses a class named Movie to store the following information about...

    write a C++ program that uses a class named Movie to store the following information about a movie: - Title - Director - Year Released - Running time (in minutes) + print() : Function that will print the information for this movie in a nice format Include a constructor that allows all four of these member data values to be specified at the time a Movie variable is created. The program should create four Movie variables and call its print()...

  • 1.C++ Write a program that uses a structure named MovieData to store the following information about...

    1.C++ Write a program that uses a structure named MovieData to store the following information about a movie: title, director, year released, and running time (in minutes). Include a constructor that allows all four of these member data values to be specified at the time a MovieData variable is created. Your program should do the followings: A. creates two MovieData variables (namely, movie1 and movie2) B. creates two pointers to the structure MovieData (namely, movie1Ptr and movie2Ptr) and initializes them...

  • Using an object-oriented approach, write a program to read a file containing movie data (Tile, Director,...

    Using an object-oriented approach, write a program to read a file containing movie data (Tile, Director, Genre, Year Released, Running Time) into a vector of structures and perform the following operations: Search for a specific title Search for movies by a specific director Search for movies by a specific genre Search for movies released in a certain time period Search for movies within a range for running time Display the movies on the screen in a nice, easy to read...

  • SC 111 - BMCC Exam Student Name: Type # 4 - 20 Points write a program...

    SC 111 - BMCC Exam Student Name: Type # 4 - 20 Points write a program that uses a structure named Student to store the following information about a Student: Name ID GPA Address The program should create three Student instances, store values, and pass all of them to a function that displays the information about the Student in a clearly formatted manner. The program also uses another function to calculate and display the average GPA of all three Students.

  • Java program. Mike's Movie Theater is a local cinema showing the latest Hollywood hits. Create a...

    Java program. Mike's Movie Theater is a local cinema showing the latest Hollywood hits. Create a class called Movie that stores basic information about a single movie: the title, the running time or length of the film (in minutes), the showtimes (as a single string, such as "11:00,3:15,7:30"), and the film's rating (R, PG-13, PG, or G). Include get and set methods for each; the setter for rating should check that the value is one of the four valid options...

  • Project Description Complete the Film Database program described below. This program allows users to store a...

    Project Description Complete the Film Database program described below. This program allows users to store a list of their favorite films. To build this program, you will need to create two classes which are used in the program’s main function. The “Film” class will store information about a single movie or TV series. The “FilmCollection” class will store a set of films, and includes functions which allow the user to add films to the list and view its contents. IMPORTANT:...

  • Write a complete C++ program that defines the following class: Class Salesperson { public: Salesperson( );...

    Write a complete C++ program that defines the following class: Class Salesperson { public: Salesperson( ); // constructor ~Salesperson( ); // destructor Salesperson(double q1, double q2, double q3, double q4); // constructor void getsales( ); // Function to get 4 sales figures from user void setsales( int quarter, double sales); // Function to set 1 of 4 quarterly sales // figure. This function will be called // from function getsales ( ) every time a // user enters a sales...

  • LAB 7-Movie List Program Goali Your assignment is to write a C++program to implement the ADT...

    LAB 7-Movie List Program Goali Your assignment is to write a C++program to implement the ADT List by creating a list of movies. This assignment will help you practice: multiple file programming, classes, pablic and private methods, dynamie memory, constructors and destructors, arrays and files Implementation the required classes This lab assignment gives you the opportunity to practice creating classes and using dynamic memory in one of There are two classes to implement: Movie and MovieList. As you can see...

  • c++ if you answer the question please write it line by line and not in paragrapth...

    c++ if you answer the question please write it line by line and not in paragrapth form. Write a C++ program that uses a structure named Movie to store the following. a. Title b. Director c. Year Released d. Running time (in minutes) e. Cost of production f. Revenue (first year). Create an array of type Movie of size 3. In your main program should then have in a loop (3 times) called a function called getData() and the purpose...

  • C++ design a class named Technician that contains private data members to store the following: -technician's...

    C++ design a class named Technician that contains private data members to store the following: -technician's name (a string) - number of service calls - total time of all service calls - average service call time the technician class should also have the following public member functions: - a constructor function that initializes all data members by obtaining their values from the users. with the exception of the average service call time which will be calculated as: total_time/number_of_call - a...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT