Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Using java * Lab Objectives: Apply the concept of abstract classes and methods. Define and implement interfaces. Use methods of the String class to perform

image text in transcribed

image text in transcribed

Using java

* Lab Objectives: Apply the concept of abstract classes and methods. Define and implement interfaces. Use methods of the String class to perform operations on Strings. 1. Modify the Show class such that it implements the Comparable interface of java.lang. Remember to add the concrete type Show between when you implement Comparable. Note the syntax error that occurs and understand why it occurs. (0.5 point) 2. Implement (override) the compareTo method in the Show class such that it compares the shows according to their rates: returns 1 if the first show's rate is greater than the second, 1 if the first show's rate is less than the second, and 0 if they are equal. (First show is "this", second show is o) (1 point) 3. Define an interface named Ratable, that has the method updateRate as shown in the UML diagram, in a file named Ratable.java. (1point) 4. Modify the Show class such that it implements the Ratable interface. Note the syntax error that occurs in the updateRate method and understand why it occurs. (0.5 point) 5. Modify the updateRate method in the Show class such that it returns a double value that represents the updated rate. 6. Modify the Platform class such that it implements the Ratable interface. Note the syntax error that occurs and understand why it occurs. 7. Implement (override) the updateRate method in the Platform class such that it returns the average of the rates of all shows in the platform. 8. Define the abstract method getDuration() in the Show class as shown in the UML diagram. Note the syntax error that occurs and understand why it occurs. 0.5 point) 9. Re-define the Show class to be abstract. Does this solve the syntax error that occurred in the previous step? Note the syntax error that occurs now in the Series class and understand why it occurs. Why doesn't the same error occur in the Movie class. ( 0.5 point) 10. Implement (override) the getDuration method in the Series class such that it returns the multiplication of the numOfEpisodes by the episodeDuration. (0.5 point) 11. In the Platform class, implement the method printTop 10 which prints the top 10 shows in the platform according to their rates in a message dialog box. If the number of shows in the platform is less than or equals 10 , it must print names and rates of the available shows ordered according to their rates from the highest rated to the least rated each on a line. If the number of shows in the platform is greater than 10 , names and rates of the ten shows with the highest rates must be printed from the highest rated to the least rated each on a line. This method must use the sort method of the Arrays class. (1 point) 12. Modify the searchShows method such that it asks the user to enter the name of the show he wants to search for or part of it. The search must be performed to find all the shows whose names contain the entered String. Names (only) of these shows must be displayed in a message dialog box each on a new line. (1 point) 13. Add the method watchAndRate to the Platform class as shown in the UML diagram. The method must ask the user to enter the name of the show he wants to watch, search for the show (assume that the user may not enter the name with case sensitivity), and invoke the updateRate method for that show. If no show with the entered name is found, you must print the following message in a message dialog box "Sorry! Could not find show with title: ....". (1 point) 14. Add the two options: Watch and Rate, Show Top10 to the options provided by the menu in the main method. For each option invoke the appropriate method. Your menu must look like the one below: (0.5 point )

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

More Books

Students also viewed these Databases questions