1. Write a Java subclass named UtsaMovieRating to meet the requirements describe
ID: 3744978 • Letter: 1
Question
1. Write a Java subclass named UtsaMovieRating to meet the requirements described in the UML Class Diagram attached to the assignment.
2. In the Java Subclass UtsaMovieRating, write a reviewsCount method with a condition statement that satisfies the following:
If reviews counted are less than 100 then print to the screen that “the total reviews from UTSA students is below an acceptable level. Hence, it is recommended you see the Box office's top-rated movie. OR if reviews counted are more than 100 then print to the screen that “the Box office's highest rated movie is also the trending movie now in UTSA.”
3. Create an object of a UtsaMovieRating subclass in the main class named Test and pass the appropriate number of arguments. (You can state any movie title, genre, votes, maxRating, and reviewCounts of your choice). Note: when passing arguments, remember the declared data types in the UML class diagram attached and the number of total votes should not be less than 1000
4. In the main class Test, write a code that prints toString method already defined in the subclass UtsaMovieRating (This is considered the last code in the Test class)
5. The only direct access to instance variable values is through the set and get methods; no other direct access is ever permitted.
NOTE: Using the instructions above, you are to complete the Test.Java scripts to be able to successfully run your subclass UtsaMovieRating.
Your output need not be identical to that shown here, but you MUST include all instance values in the output, in the order shown:
The Top-rated movie on Box office this week is: Jumanji
Genre: Adventure
Currently has a total vote of 1000 and a rating of 8.20 over 10.
And total reviews of: 200:
Superclass BoxOiiceMovie private title: String Movie title Movie Movie total votes Movie maximum rati private votes: int maxRating: double BoxOfficeMovie( title: String, genreString Constructor accepting four(4) parameters, with String and int types Rets a fully formed and votes: int, maxRating:int):BoxofficeMovie fully functional BoxofficeMovie object eference. With a condition statement indicating votes below 1000 is not acceptable blicsetntlet title: String ]: void public setGenre genre: int]: void votes: int j:void a Stri (local name: tite) and assigns it to the instance variable title Accepts a String object (local name: and assigns it to the instance variable genre lic a int object (local name: votes) and assigns it to the instance variable votes public setMaxRatingi maxRating: int ): void Accepts a double object (local name:nadRalting) and assigns it to the instance variable licgetTitle public getGenre :String Retums the arrent value of instance variable title Retums the arrent value of instance variable genre Retums the arrent value of instance variablevotes Retums the arrent value of instance variablenaRatin lic int public ting)double publictoString):String Rts a formatted String containing the arrent values of each of the object's instance variables. Subclass UtsaMovieRating private final reviewsCount: int Movie reviews count UtsaMovieRating (title:String, genreString, votes: Subclass constructor accepting five(5) parameters, with String and int types. Returns a fully int, maxRating:int, intreviewsCount): UtsaMovieRating super (title: String, genre String,votes: int, maxRating:int) :super formed and fully functional UtsaMovieRating object reference. Invoke superdass contructorby using the super keyword accepting four(4) parameters, with String and int types. Returns a fully formed and fully functional UtsaMovieRating object reference. With a condition statemenit indicating votes below 1000 is not acceptable public getReviewsCount):int Retums the arrent value of instance variable reiewsCount. And printing out conditional statemerits (check attachednstruuctioas publictoString( ):String Retums a formatted String conitaining thearrenit values super toStrong and reviewsCountExplanation / Answer
class BoxOfficeMovie // super class
{
private String title;
private String genre;
private int votes;
private double maxRating;
public BoxOfficeMovie(String title,String genre,int votes,double maxRating) // constructor
{
this.title = title;
this.genre = genre;
if(votes < 1000)
System.out.println("Votes below 1000 is not acceptable");
else
this.votes = votes;
this.maxRating = maxRating;
}
//set and get methods
public void setTitle(String title)
{
this.title = title;
}
public void setGenre(String genre)
{
this.genre = genre;
}
public void setVotes(int votes)
{
if(votes < 1000)
System.out.println("Votes below 1000 is not acceptable");
else
this.votes = votes;
}
public void setMaxRating(double maxRating)
{
this.maxRating = maxRating;
}
public String getTitle()
{
return title;
}
public String getGenre()
{
return genre;
}
public int getVotes()
{
return votes;
}
public double getMaxRating()
{
return maxRating;
}
public String toString()
{
String str;
str = "The Top-rated movie on Box office this week is: "+ title;
str += " Genre: "+genre;
str += " Currently has a total vote of "+votes+" and a rating of "+maxRating+" over 10.";
return str;
}
}
class UtsaMovieRating extends BoxOfficeMovie
{
private final int reviewCount;
public UtsaMovieRating(String title,String genre,int votes,double maxRating,int reviewCount)
{
super(title,genre,votes,maxRating);// call to base class constructor
if(reviewCount < 100)
System.out.println("The total reviews from UTSA students is below an acceptable level. Hence, it is recommended you see the Box office's top-rated movie.");
else
System.out.println("The Box office's highest rated movie is also the trending movie now in UTSA.");
this.reviewCount = reviewCount;
}
public int getReviewsCount()
{
return reviewCount;
}
public String toString()
{
return super.toString()+" And total reviews of: "+reviewCount;
}
}
class Test
{
public static void main (String[] args)
{
UtsaMovieRating ur = new UtsaMovieRating("Jumanji","Adventure",1000,8.2,200);
System.out.println(ur);
}
}
Output:
The Box office's highest rated movie is also the trending movie now in UTSA.
The Top-rated movie on Box office this week is: Jumanji
Genre: Adventure
Currently has a total vote of 1000 and a rating of 8.2 over 10.
And total reviews of: 200
Do ask if any doubt. Please upvote.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.