Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Create a class MP3 with instance variables for: artist, song, album, track length (in seconds). Provide a constructor with four parameters, get/set methods, and a

Create a class MP3 with instance variables for: artist, song, album, track length (in seconds). Provide a constructor with four parameters, get/set methods, and a toString. method. The toString method should return a String with MP3 data clearly labeled. The track length should be converted into minutes and seconds in the toString method. For example, 265 seconds would be displayed as 4:25. NOTE that an MP3 cannot have a zero or negative track length. Use the default value of one minute for an invalid track length. Create a UML class diagram for the MP3 class.

Create an MP3Collection class with instance variables count and an MP3 ArrayList. The class should have a no-argument constructor, a get method for the count and a toString method that returns the information for all MP3s in the collection. The class will also have an addMP3 method that takes 4 arguments, creates an MP3 object and places it in the MP3 collection (ArrayList). Count each MP3 added to the collection. Create a UML class diagram for the MP3Collection class.

Create a test program MP3CollectionTest that adds AT LEAST 5 MP3s to the MP3 collection. Use literal data for real MP3s. The program outputs the number of MP3s in the collection and the information about all MP3s in the collection. Be sure to clearly label the output and to comment your code. Use a dialog box for output. Your name must appear in the output. Do NOT use the MP3 class in the test program.

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

Database Administrator Limited Edition

Authors: Martif Way

1st Edition

B0CGG89N8Z

More Books

Students also viewed these Databases questions