Question: Produce the desire output. Beginning of code written:CS 2 2 6 Programming Project Create a class named Movie that can be used with your video
Produce the desire output. Beginning of code written:CS Programming Project
Create a class named Movie that can be used with your
video rental business. The Movie class should track the
Motion Picture Association of America MPAA rating G
PG R the movie's ID number and title with appropriate
setter and getter methods. Also create an equals method
that overrides the Object's equals method, where two
movies are equal if their ID numbers are equal.
Create three additional classes named Action, Comedy, and Drama that are derived
from Movie. Create an overridden method named calcLateFees that takes as input
the number of days a movie is late and returns the late fee for that movie. The
default late fee is $ day. Action movies have a late fee of $ day, comedies are
$ day, and dramas are $ day.
Add a Rental class. This class should store a Movie that is rented, an integer
representing the ID of the customer that rented the movie, and an integer
representing how many days late the movie is Include a method that calculates the
late fee for the rental.
In your main method, create an array or ArrayList of type Rental filled with sample
data for various type of movies. Then create a method called lateFeesOwed that
iterates through the array and returns the total amount of late fees outstanding.
Draw a UML diagram that illustrates the relationship between these classes.
On the day of the final exam Wednesday April ::PM be prepa
import java.util.ArrayList;
public class Test
public static void mainString args
ArrayList listOfRentals new ArrayList;
Movie m new DramaG "Title;
Movie m new ActionPG "Title;
Movie m new ComedyG "Title;
Movie m new DramaR "Title;
Movie m new ActionR "Title;
Rental r new Rentalm;
Rental r new Rentalm;
Rental r new Rentalm;
Rental r new Rentalm;
Rental r new Rentalm;
listOfRentals.addr;
listOfRentals.addr;
listOfRentals.addr;
listOfRentals.addr;
listOfRentals.addr;
rsetDaysLate;
rsetDaysLate;
rsetDaysLate;
rsetDaysLate;
rsetDaysLate;
double total ;
for int i ; i listOfRentals.size; i
System.out.printlnlistOfRentalsgeticalculateLateFee;
class Movie
private String mpaaRating;
private int id;
private String title;
public MovieString mpaaRatin, int id String title
this.mpaaRating mpaaRating;
this.id id;
this.title title;
public String getMpaaRating
return mpaaRating;
public void setMpaaRatingString mpaaRating
this.mpaaRating mpaaRating;
public int getId
return id;
public void setIdint id
this.id id;
public String getTitle
return title;
public void setTitleString title
this.title title;
public double calcLateFeesint daysLate
return daysLate;
@Override
public boolean equalsObject obj
if this obj
return true;
if obj null getClass obj.getClass
return false;
Movie movie Movie obj;
return id movie.id;
class Rental
private Movie movie;
private int customerId;
private int daysLate;
public RentalMovie movie, int customerId, int daysLate
this.movie movie;
this.customerId customerId;
this.daysLate daysLate;
public void setDaysLateint daysLate
this.daysLate daysLate;
public int getDaysLate
return daysLate;
public double calculateLateFee
return movie.calcLateFeesdaysLate;
class Comedy extends Movie
public ComedyString mpaaRating, int id String title
supermpaaRating id title;
@Override
public double calcLateFeesint daysLate
return daysLate;
class Drama extends Movie
public DramaString mpaaRating, int id String title
supermpaaRating id title;
@Override
public double calcLateFeesint daysLate
return daysLate;
class Action extends Movie
public ActionString mpaaRating, int id String title
supermpaaRating id title;
@Override
public double calcLateFeesint daysLate
return daysLate;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
