Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

import java.util.Date; public class Movie { public Movie(String string, int i, String string2, Date now) { // TODO Auto-generated constructor stub } public Object getRating()

image text in transcribedimage text in transcribed

import java.util.Date;

public class Movie {

public Movie(String string, int i, String string2, Date now) { // TODO Auto-generated constructor stub }

public Object getRating() { // TODO Auto-generated method stub return null; }

public Object getDirector() { // TODO Auto-generated method stub return null; }

public Object getReleaseDate() { // TODO Auto-generated method stub return null; }

public void setReleaseDate(Date d) { // TODO Auto-generated method stub }

public void setDirector(String string) { // TODO Auto-generated method stub }

public void setRating(int i) { // TODO Auto-generated method stub }

public Object getCategory() { // TODO Auto-generated method stub return null; }

public Object getTitle() { // TODO Auto-generated method stub return null; } public int getTime() { return 0; }

}

public class Theatre {

public Theatre(String string, int i) { // TODO Auto-generated constructor stub }

public Theatre(Theatre c) { // TODO Auto-generated constructor stub }

public Object getTitle() { // TODO Auto-generated method stub return null; }

public Object getRating() { // TODO Auto-generated method stub return null; }

public void setTitle(String string) { // TODO Auto-generated method stub }

public void setRating(int i) { // TODO Auto-generated method stub }

public Object getCategory() { // TODO Auto-generated method stub return null; }

}

public class Play {

public Play(String string, int i, String string2, int j) { // TODO Auto-generated constructor stub }

public Object getTitle() { // TODO Auto-generated method stub return null; }

public Object getRating() { // TODO Auto-generated method stub return null; }

public Object getWriter() { // TODO Auto-generated method stub return null; }

public Object getYearWritten() { // TODO Auto-generated method stub return null; }

public void setYearWritten(int i) { // TODO Auto-generated method stub }

public void setWriter(String string) { // TODO Auto-generated method stub }

public void setRating(int i) { // TODO Auto-generated method stub }

public Object getCategory() { // TODO Auto-generated method stub return null; }

}

Requirements for Skeleton of Theatre, Movie and Play Theatre titie: String rating int heatre (aitleistring, aRating: int) Theatre (toCopy:Theatre) getitle): String getcetegory): Sering getRating : int +setRating (aRating:int) Movie Play di rector: String writer: String releaseDate: Date arWritten: int tMovie(aTitle:String, aRatingiint, aDirector:String, +Play(aTitle:String, aRating:int,aWriter:String, aReleaseDate: Date) yearNritten:int) tovie(toCopy:Movie) +getCategory) :String +getDirector): String +oetDirector(aDirector:String) +getReleaseDate Date tsetReleaseDate (aReleaseDate :Date) +Play (toCopy: Play) tgetYearWritten int +setYearWritten (year :int) tgetWriter( String +setwriter (awriter:String) tgetCategory: String Additional Requirements Theatre title: The instance should always store the string in all upper case, if the method is called with a string that contains any lower case characters, the lower case characters should be converted to upper case rating must be a value between 0 and 10 (inclusive). If the rating provided is outside of that range, the rating should remain unchanged getCategory: A movie is considered A category if its rating is 9 or 10, B category if the rating is 7 or 8, C category if the rating is 5 or 6, D category if the rating is 3 or 4 and F category otherwise Movie releaseDate: Is at most one year in the future. Otherwise leave unchanged. If no date set at all set the release date to the current date. getCategory: Override from parent to precede with release date and '-'. Call parent getCatego y to accomplish this, do not call getRating from parent. Play yearWritten: must be before 2019. getCategory: Override from parent to return 'Classic' if it was written more than 200 years ago, 'Contemporary if it was written more than 50 years ago and Modern' otherwise. Using the Date class * Import from java.util The only Date class you need to create is one that represents now, which is returned by the default constructor in the Date class. All other dates will be passed as arguments. (Note that this may be null) The method getTime() in the Date class returns the number of milliseconds since the Epoch. If you have two Date objects d1 and d2, with d1 a later date, the number of milliseconds between the two is d1.getTime)-d2.getTime() .Use boolean methods before(Date) and after(Date) to compare two dates. For example, d1.before(d2) will return true if d1 appears in time before d2. Notes: Do not duplicate instance variables from parent class in child class. Instead invoke appropriate super constructor and methods in parent class. Requirements for Skeleton of Theatre, Movie and Play Theatre titie: String rating int heatre (aitleistring, aRating: int) Theatre (toCopy:Theatre) getitle): String getcetegory): Sering getRating : int +setRating (aRating:int) Movie Play di rector: String writer: String releaseDate: Date arWritten: int tMovie(aTitle:String, aRatingiint, aDirector:String, +Play(aTitle:String, aRating:int,aWriter:String, aReleaseDate: Date) yearNritten:int) tovie(toCopy:Movie) +getCategory) :String +getDirector): String +oetDirector(aDirector:String) +getReleaseDate Date tsetReleaseDate (aReleaseDate :Date) +Play (toCopy: Play) tgetYearWritten int +setYearWritten (year :int) tgetWriter( String +setwriter (awriter:String) tgetCategory: String Additional Requirements Theatre title: The instance should always store the string in all upper case, if the method is called with a string that contains any lower case characters, the lower case characters should be converted to upper case rating must be a value between 0 and 10 (inclusive). If the rating provided is outside of that range, the rating should remain unchanged getCategory: A movie is considered A category if its rating is 9 or 10, B category if the rating is 7 or 8, C category if the rating is 5 or 6, D category if the rating is 3 or 4 and F category otherwise Movie releaseDate: Is at most one year in the future. Otherwise leave unchanged. If no date set at all set the release date to the current date. getCategory: Override from parent to precede with release date and '-'. Call parent getCatego y to accomplish this, do not call getRating from parent. Play yearWritten: must be before 2019. getCategory: Override from parent to return 'Classic' if it was written more than 200 years ago, 'Contemporary if it was written more than 50 years ago and Modern' otherwise. Using the Date class * Import from java.util The only Date class you need to create is one that represents now, which is returned by the default constructor in the Date class. All other dates will be passed as arguments. (Note that this may be null) The method getTime() in the Date class returns the number of milliseconds since the Epoch. If you have two Date objects d1 and d2, with d1 a later date, the number of milliseconds between the two is d1.getTime)-d2.getTime() .Use boolean methods before(Date) and after(Date) to compare two dates. For example, d1.before(d2) will return true if d1 appears in time before d2. Notes: Do not duplicate instance variables from parent class in child class. Instead invoke appropriate super constructor and methods in parent class

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

DNA Databases

Authors: Stefan Kiesbye

1st Edition

0737758910, 978-0737758917

More Books

Students also viewed these Databases questions