Question: How this can be done in PHP? The class Movie is started below. An instance of class Movie represents a film. This class has the

How this can be done in PHP?

The class Movie is started below. An instance of class Movie represents a film. This class has the following three class variables:

  • title, which is a string representing the title of the movie
  • studio, which is a string representing the studio that made the movie
  • rating, which is a string representing the rating of the movie (i.e. PG13, R, etc)
  1. Write a constructor for the class Movie, which takes the title of the movie, studio, and rating as its arguments, and sets the respective class variables to these values.
  2. Write a method GetPG, which takes an array of base type Movie as its argument, and returns a new array of only those movies in the input array with a rating of "PG". You may assume the input array is full of Movie instances. The returned array may be empty.
  3. Write a piece of code that creates an instance of the class Movie:
    • with the title Casino Royale, the studio Eon Productions and the rating PG13;
    • with the title Glass, the studio Buena Vista International and the rating PG13;
    • with the title Spider-Man: Into the Spider-Verse, the studio Columbia Pictures and the rating PG.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!