Create a class called song that has 3 attributes-title


Question in Computer Science Asked on April 22, 2013 Answers (1)
These programs use the Java "Stack" class (API) to create stacks. You will be creating a program that implements a stack of Songs.

Step 1: Create a class called Song that has 3 attributes-title, artist, and price (which will be entered later as either 0.99 or 1.49). It should contain 2 constructor methods, all the necessary set and get methods, and a "toString" method that prints the values of the 3 attributes.

Step 2: Create a class called "SimpleSongStack" which will be used for creating a stack of Song objects.

Step 3: Create a class called "UseSimpleSongStack" which will utilize the "SimpleSongStack" class to create a stack of songs. This program will initialize an "ITunesGiftCard" variable to $15.00. Then it will set up a while loop to request a Song object's data, create a Song object from the data, and push the Song object onto the stack. The loop should track the money spent on each song ordered (either 0.99 or 1.49) and subtract it from the gift card total. When the money has been spent (no more songs can be purchased), the loop should terminate. After the loop finishes, the program should report the "Songs Recently Purchased". To do this, pop each song object from the song stack and call it's "toString" method.

 

Request for Solution File

Ask an Expert for Answer!!
Computer Engineering: Create a class called song that has 3 attributes-title
Reference No:- TGS0661373

Expected delivery within 24 Hours