Question: Create an interface called edu.udc.cs2.Song. Song must have 2 methods defined like: public String getSongName(); public int getSeconds(); //returns the number of SECONDS the song

Create an interface called edu.udc.cs2.Song. Song must have 2 methods defined like:

public String getSongName();

public int getSeconds(); //returns the number of SECONDS the song lasts

Create a class named edu.udc.cs2.Midterm. Create the following method:

public static void showSong(List lst)

The method must iterate the passed in List of Song and will output according to the following:

If the song is outside of the range of 2 seconds and 20 minutes, inclusive, throw a RuntimeException at which point the program will automatically end unless you include a try catch in your call.

If the getSeconds() method returns the number of seconds more than 5 minutes, output:

song name is a long song.

if less than 5 minutes, output:

song name is a short song.

Where song name is the name returned from getSongName() method.

Turn in TWO classes Song.java and Midterm.java.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!