CMPS 258 – PROGRAMMING LANGUAGES – WEEK 7 ASSIGNMENT – PART 2 solution

$29.99

Original Work ?
Category: You will Instantly receive a download link for .ZIP solution file upon Payment

Description

5/5 - (5 votes)

You have been provided with a Main.java file that implements two classes Audio and Video that represent two different types of playable objects. Both classes contain a method playbackTime that returns how long it takes to listen to the audio object or watch the video object. You are to implement polymorphic class methods in the class Main that manipulate these objects. Make sure to use the most general type of polymorphism for implementing each method. It is okay if the method works in other scenarios, as long as it works in the scenarios specified. You are not allowed to add or modify fields and methods in the Audio and Video classes, but you are allowed to modify the class declarations if you need to. The code also contains test code in the main function that is expected to work for a correct solution. Do not modify this test code. 1. Implement a polymorphic function selectRandom that takes a List