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

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

ID: 3767197 • Letter: C

Question

Create a class names 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, PG 13, R), ID Number and the movie title with appropriate accessor and mutator methods. Also, creat an equals ( ) method that overrides Object's equals ( ) methods, where two movies are equal if their ID number is identical. Next, creat three additional 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 the movie. The default late fee is $2/day. Action movies have a late fee of $3/day, comedies $2.50/day, and dramas are $2/day. Test your classes from a main method.

Explanation / Answer

import java.util.*;
public class Movie
{
String rating = null;
String title = null;
int ID = 0;
int rentTime;
double lateFee;
double Fee;
public Movie(String theTitle, String theRating, int theID, int theRentTime)
{
setRating(theRating);
setTitle(theTitle);
setID(theID);
setRentTime(theRentTime);
}
public String getRating()
{
return rating;
}
public void setRating(String theRating)
{
if (theRating != null)
{
rating = theRating;
}
}
public String getTitle()
{
return title;
}
public void setTitle(String theTitle)
{
if (theTitle != null)
{
title = theTitle;
}
}
public int getID()
{
return ID;
}
public void setID(int theID)
{
if (theID > 0)
{
ID = theID;
}
}
public int getRentTime()
{
return rentTime;
}
public void setRentTime(int theRentTime)
{
if (theRentTime > 0)
{
rentTime = theRentTime;
}
}
public int equals(int theID)
{
if (ID == theID)
{
System.out.println("Movies are identical.");
}
return ID;
}
public double calcLateFees(double lateFee, int rentTime, double Fee)
{
if (rentTime > 1)
{
Fee = (rentTime * lateFee);
}
return Fee;
}
public void MovieDetails()
{
System.out.println("The movie title is " + title + ". The rating is " + rating + ". The ID is " + ID + ".");
System.out.println("The late fee cost is: " + Fee + ".");
}
public static void main(String[] args)
{
Movie rental1 = new Comedy("Men In Black", "PG 13", 123456789, 5, "Comedy");
Movie rental2 = new Action("Lord of the Rings: Return of the King", "PG 13", 223456789, 4, "Action");
Movie rental3 = new Drama("Dispicable Me", "G", 243534, 7, "Drama");
System.out.println("Rental1 details:");
rental1.MovieDetails();
System.out.println("Rental2 details:");
rental2.MovieDetails();
System.out.println("Rental3 details:");
rental3.MovieDetails();
}
}


Caluclate Fee's:

import java.util.*;
public class Action extends Movie
{
String Genre = null;
double lateFee = 3;
int rentTime;
double Fee;
public Action(String theRating, String theTitle, int theID, int theRentTime, String theGenre)
{
super(theRating, theTitle, theID, theRentTime);
setGenre(theGenre);
}
public String getGenre()
{
return Genre;
}
public void setGenre(String theGenre)
{
if (theGenre != null)
{
Genre = theGenre;
}
}
public double calcLateFees(double lateFee, int rentTime, double Fee)
{
if (rentTime > 1)
{
Fee = (rentTime * lateFee);
}
return Fee;
}
public void MovieDetails()
{
System.out.println("The movie title is: " + title + ". The rating is: " + rating + ". The ID is: " + ID + ". The rent time is: " + rentTime + ". The genre is: " + Genre + ".");
System.out.println("The late fee costs are: " + Fee + ".");
}
}

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