Create a class called song that has 3 attributes-title

Assignment Help Computer Engineering
Reference no: EM13322703

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.

 

Reference no: EM13322703

Pros and cons of the model-view-controller

define the benefits and limitations of the model-view-controller (MVC) principle. Identify one way in which MVC helps software designers create better code, and one way in w

What is normalization process and the different normal forms

What are the steps for designing a relational database from a domain class model? What is the normalization process and the different normal forms? Why is normalization import

One control against accidental software deletion

One control against accidental software deletion is to save all old versions of a program. Of course, this control is prohibitively expensive in terms of cost of storage. Su

What is the problem that can be solved by business analytics

What is the problem that can be solved by business analytics. Provide a specific example where this applies.What kind of data would you need to do this. Where can you find suc

Write all possible node and edge facts

COMP348: PRINCIPLES OF PROGRAMMING LANGUAGES - write all possible node and edge facts that describes the structure of this graph - Implement your facts & rules as a Prolog pro

Analyze the photo from another theoretical perspective

Choose a magazine photo and analyze its content from one of the perspectives described in this chapter. Then analyze the photo from another theoretical perspective. How do y

Express about choosing which server-side scripting language

You've been hired by Company X to create a web site which will include a data-driven component. Describe how you would go about choosing which server-side scripting language

Develop an application with the chosen dbms

A school intends to procure the integrated student management application holding all details of registered students including personal information, courses taken, and exami

Reviews

Write a Review

 
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd