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

  Explain the purpose of each of these approaches

explain the purpose of each of these approaches.

  Write a program based on encryption scheme

Write a program based on encryption scheme.

  How much of a disadvantage computer scientists have

Philosophy is deeply rooted in the History of Computers starting with Leibniz and his concept of binary. Leibniz's dream imagines Armchair Philosopher to be left alone with his thoughts while machines take care of all the other menial tasks requir..

  Interpreted code execute much more slowly than compiled code

interpreter mode and compiler mode), JavaScript and special case of interpretation of Java programs. Discuss the merits and weaknesses of interpreting, as opposed to compiling, and explain when and why they are used.

  Define the process necessary to properly install

This solution gives students the resources and tips necessary to properly specify the process to replace a computer's power supply.

  Program which operates as a generic simple json parser

Create a program which operates as a generic Simple JSON parser. Simple JSON is our version of JSON that only supports variables with values of type: String or Simple JSON.

  Explain the costs involved in the creation of the system

Describe the types of business needs that can be addressed using information technology-based solutions.

  The main program will after that print out the initial

How do you write down a Method (using Java) that calculates your weight on the moon.The main program needs to prompt the user for a weight and pass that to the MoonWeight Method (fexample variable name â?" Iâ??m just using).

  Define network activities and maintaining security

This solution provides the learner with an understanding of network activity monitoring. In particular, solution provides a discussion on potential management plans fo monitoring network activities and maintaining security of the network.

  Is snort an hids or an nids

What kind of file is Snort output (logging info) stored in? 7. Can you use Snort with network switches? With hubs? 8. What operating system(s) does Snort run on?

  Explain what is the future of databases

What is the future of databases? Try to picture databases in the year 2050, what would they store? How will  they "look and feel"? Please be creative, yet believable.

  Recognize the top-level objects of the microwave

make a table with the following four column headings: Top-Level Objects, Communicates With, Incoming Messages, and Outgoing Messages.

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