Question: JAVA HELP . . Write a Java console application that manages song data. The application has the following two classes: . Song.java This class represents

JAVA HELP

.

.

Write a Java console application that manages song data. The application has the following two classes:

.

Song.java

This class represents one song and includes:

.

Fields

static songCount initialize to 0 in declaration.

static totalCost initialize to 0 in declaration.

title

yearReleased

downloadCost

.

A constructor with no parameters that sets the fields, respectively, to these values:

songCount = songCount + 1

title = "(not set)"

yearReleased = -1

downloadCost = -1

.

A constructor with three parameters that sets the fields, respectively, to these values:

songCount = songCount + 1

totalCost = totalCost + downloadCost

title set from parameter

yearReleased set from parameter

downloadCost set from parameter

.

Getter methods for each field (declare the getters for songCount and totalCost static).

.

Setter methods for each non-static field.

.

equals method that compares title, yearReleased, and downloadCost for equality.

.

toString method for returning instance variable values only.

.

.

HW6.java

This class contains the main method and uses the other class to manage song data. Store data in an array list called songs. Present the following menu to the user:

.

Music Magicians Menu

1 Add song

2 Delete song

3 List songs

4 Exit

Enter an option:

.

Here are what the options do:

.

Add song prompts for and gets from the user a song title, year released, and download cost. If the song already exists in the array list, it prints an error message. If the song doesnt exist in the array list, it creates a song object using the three-parameter constructor, stores it in the array list, and prints a message. After reading the download cost, clear the keyboard buffer with statement junk = keyboard.nextLine();

.

Delete song prompts for and gets from the user a song title and searches the array list for the title. If the song doesnt exist in the array list, it prints an error message. If the song already exists in the array list, it removes it from the array list and prints a message. After reading the song title, clear the keyboard buffer with statement junk = keyboard.nextLine();

.

List songs shows all song data in formatted columns. It then lists the number of songs and the total download cost.

.

Exit clears the array list and ends the application.

.

Continue to process menu options until the user enter 4.

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!