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

Questions Cloud

Calculate the change in length of the aluminum rod : A straight rod consists of a 2cm long piece of aluminum attached to a 3cm long piece of steel. calculate the change in length of the aluminum rod
Calculate the power input to the pump in kw : A 60 MW Rankine steam power cycle in Iceland uses reheat. The system is comprised of a single adiabatic pump, a boiler using geothermal energy, two adiabatic turbine stages and a condenser.
Write a program that demonstrates the coin class : Write a program that demonstrates the Coin class. The program should create an instance of the class and display the side that is initially facing up.
Explain what is the final volume of the gas : The pressure of 6.0 L of an ideal gas in a flexible container is decreased to one-sixth of its original pressure, and its absolute temperature is decreased to one-forth of the original. What is the final volume of the gas
Create a class called song that has 3 attributes-title : 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..
What is the tension in the right cable : A 200-N beam is held horizontally by a vertical steel cable at each end. The beam is 18 m long. A 650-N box sits 3.0 m from the left end. What is the tension in the right cable
Advertising to children in school is morally objectionable : Advertising to children in school is morally objectionable to many people. Some of the reasons used to criticize the practice include the following: First, children at school are a captive audience. Second, children are not yet autonomous and a..
Compute the final volume of the balloon : A gas-filled balloon having a volume of 2.00 L at 1.2 atm and 25°C is allowed to rise to the stratosphere (about 30 km above the surface of Earth), where the temperature and pressure are -23°C and 3.00 10-3 atm, respectively. Calculate the final v..
Write a function that accepts as arguments the following : The function should determine the median of the array. This value should be returned as double. (Assume the values in the array are already sorted).

Reviews

Write a Review

Computer Engineering Questions & Answers

  Give some of the major threats to information systems

What will happen if that information were compromised? What are some of the main threats to information systems? Provide three examples to support your answer.

  Find the rest are in the kitchen for the chef''s staff.

throughout Phase One of this project, your job is to set up the Windows Server 2003 and train two of the management staff on its operation.

  Recognizing the asset and threat

Propose the reasonable values for items in the risk register for this asset and threat, and offer the justifications for your choices.

  The evolution of a health care information system

Discussion of an evolution of a health care information system, such as order entry results reporting, electronic health record, office-based medical records, or others. Include the following.

  Create a database for the company

Create a database for the company.

  Performance clause in the license agreement

Explain why is it significant to have the performance clause within the license agreement?

  Which is the first line of a class definition

Look at the following code, which is the first line of a class definition: public class Tiger extends Felis In what order will the class constructors execute?

  Find out whether the list is empty

Write down the functions (in C++) to perform these basic operations on Linked List.

  Creating a traffic light with three small square text boxes

Create a traffic light having three small square text boxes substituted vertically on the form initially, bottom text box is solid green and other text boxes are dark gray.

  Getters would provide access to the attributes.

For this task you will make a Subject class, whose instances will represent the subjects for study at a university. A subject will have a name, just a String, and a subject code, that is a six-character String.

  Systems analyst at a manufacturing company in seattle

You are the Systems Analyst at a manufacturing company in Seattle, WA. A Systems Analyst in your company's New York office sends you a trace file to analyze. The complaint is that an end-users machine cannot connect to any of the network devices o..

  Define how architectural and protocol changes occur

express how architectural and protocol changes occur, the administrative organization that oversees the technical development of the Internet, and the process that each protocol must undergo to become an Internet Standard.

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