Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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_2

Step: 3

blur-text-image_3

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

Data Management Databases And Organizations

Authors: Richard T. Watson

3rd Edition

0471418455, 978-0471418450

More Books

Students also viewed these Databases questions