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

  Mathematics in computing

Binary search tree, and postorder and preorder traversal Determine the shortest path in Graph

  Ict governance

ICT is defined as the term of Information and communication technologies, it is diverse set of technical tools and resources used by the government agencies to communicate and produce, circulate, store, and manage all information.

  Implementation of memory management

Assignment covers the following eight topics and explore the implementation of memory management, processes and threads.

  Realize business and organizational data storage

Realize business and organizational data storage and fast access times are much more important than they have ever been. Compare and contrast magnetic tapes, magnetic disks, optical discs

  What is the protocol overhead

What are the advantages of using a compiled language over an interpreted one? Under what circumstances would you select to use an interpreted language?

  Implementation of memory management

Paper describes about memory management. How memory is used in executing programs and its critical support for applications.

  Define open and closed loop control systems

Define open and closed loop cotrol systems.Explain difference between time varying and time invariant control system wth suitable example.

  Prepare a proposal to deploy windows server

Prepare a proposal to deploy Windows Server onto an existing network based on the provided scenario.

  Security policy document project

Analyze security requirements and develop a security policy

  Write a procedure that produces independent stack objects

Write a procedure (make-stack) that produces independent stack objects, using a message-passing style, e.g.

  Define a suitable functional unit

Define a suitable functional unit for a comparative study between two different types of paint.

  Calculate yield to maturity and bond prices

Calculate yield to maturity (YTM) and bond prices

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