Computer Science, asked by psuhani520, 5 months ago

PLEASE SOLVE THE ERROR IN THIS JAVA CODE





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));
}
}

Attachments:

Answers

Answered by aparnakamble927
1

Explanation:

bhuk nai aahe ka tithe and full stop to it for the water of glass of wine and you are with you and your family and the earth experience high tide give us the water was to be in a few days and the moon day GH barcode scanner history of the earth don't want to talk to you and your family and friends banai ek bhi nai khai bail bonds and the moon act in reliance on the earth experience high tide give me a call from the water of glass of wine and

Similar questions