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

Java Programming: \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\Driver.java\\\\\\\\\\\\\\\\\

ID: 3679677 • Letter: J

Question

Java Programming:

\\\\\\\\Driver.java\\\\\\\\

public class Driver {

   public static void main(String[] args) {
       ActionMovie killbill2 = new ActionMovie(0, "Kill Bill: Volume 2", "R");
       ComedyMovie meangirls = new ComedyMovie(1, "Mean Girls", "PG-13");

       System.out.println("If " + killbill2.getTitle()
               + " is 2 days late the fee is " + killbill2.calcLateFees(2));
       System.out.println("If " + killbill2.getTitle()
               + " is 3 days late the fee is " + killbill2.calcLateFees(3));
       System.out.println("If " + meangirls.getTitle()
               + " is 3 days late the fee is " + meangirls.calcLateFees(3));
   }
}

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 an equals 0 method that overrides Object's equals0 method, where two movies are equal if their ID number is identical. Next, create three additional classes named Action and Comedy 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 and $2.5/day. Note: Please use the supplied Driver.java to test your classes What to turn in: The following Two classes: Movie.java Action.java Comedy.java

Explanation / Answer

MOvie class:

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("FAST AND FURIOUS", "20", 5682658, 3, "ACTION");
Movie rental2 = new Action("KILL BILL:", "PG 25", 223456789, 5, "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();
}
}

Action class:

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