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

Create a class named Movie that can be used with your video rental business. The

ID: 3634134 • Letter: C

Question

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 (e.g., Rated G, PG-13, R), ID Number, and movie title with appropriate accessor and mutator methods. Also create and equals() method that overrides Object's equals() method, where two movies are equal if their ID number is identical.

Next, create three additional movie classes named Action, Comedy, and Drama that are derived from Movie. Finally, 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 $2/day. Action movies have a late fee of $3/day, comedies are $2.50/day, and dramas are $2/day.

In Addition to the project create and add:
All appropriate accessor and mutator methods(Getters and setters)
an "equals ' method
a toString method
a default(noargument) constructor
and Overloaded constructor
a copy constructor
a clone method
a finalize method
a dispose method

public class Movie
{
// instance variables
private String rating;
private int id;
private String title;

// constructors
public Movie(String title, int id, String rating)
{
setTitle(title);
setID(id);
setRating(rating);
}

// mutators
public void setID(int i)
{
id = i;
}
public void setTitle(String t)
{
title = t;
}
public void setRating(String r)
{
rating = r;
}

// accessors
public int getID()
{
return id;
}
public String getTitle()
{
return title;
}
public String getRating()
{
return rating;
}

public double calcLateFees(int numDays)
{
return 2.0*numDays;
}

public boolean equals(Object o)
{
Movie rhs = (Movie)o;

return rhs.id == id;
}
}
public class Action extends Movie
{
public Action(String title, int id, String rating)
{
super(title, id, rating);
}

public double calcLateFees(int numDays)
{
return 3.0*numDays;
}
}

public class Comedy extends Movie
{
public Comedy(String title, int id, String rating)
{
super(title, id, rating);
}

public double calcLateFees(int numDays)
{
return 2.5*numDays;
}
}

public class Drama extends Movie
{
public Action(String title, int id, String rating)
{
super(title, id, rating);
}

public double calcLateFees(int numDays)
{
return 2.0*numDays;
}
}
public class Driver
{
public static void main(String[] args)
{
Movie test1 = new Movie("test1", 1, "PG");
Movie test2 = new Action("test2", 2, "G");
Movie test3 = new Comedy("test3", 3, "PG-13");
Movie test4 = new Drama("test4", 4, "R");

System.out.println(test1.getID()+" "+test1.getTitle()+" "+test1.getRating()+" "+test1.calcLateFees(1));
System.out.println(test2.getID()+" "+test2.getTitle()+" "+test2.getRating()+" "+test2.calcLateFees(2));
System.out.println(test3.getID()+" "+test3.getTitle()+" "+test3.getRating()+" "+test3.calcLateFees(3));
System.out.println(test4.getID()+" "+test4.getTitle()+" "+test4.getRating()+" "+test4.calcLateFees(4));
}
}

Explanation / Answer

public class Driver { public static void main(String[] args) { Movie test1 = new Movie("test1", 1, "PG"); Movie test2 = new Action("test2", 2, "G"); Movie test3 = new Comedy("test3", 3, "PG-13"); Movie test4 = new Drama("test4", 4, "R"); System.out.println(test1.getID()+" "+test1.getTitle()+" "+test1.getRating()+" "+test1.calcLateFees(1)); System.out.println(test2.getID()+" "+test2.getTitle()+" "+test2.getRating()+" "+test2.calcLateFees(2)); System.out.println(test3.getID()+" "+test3.getTitle()+" "+test3.getRating()+" "+test3.calcLateFees(3)); System.out.println(test4.getID()+" "+test4.getTitle()+" "+test4.getRating()+" "+test4.calcLateFees(4)); } }

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