Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Engineering Expert

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.

 

Computer Engineering, Engineering

  • Category:- Computer Engineering
  • Reference No.:- M9902005

Have any Question?


Related Questions in Computer Engineering

What is marketing discipline what is most peoples

What is marketing discipline? What is most people's perception of marketing discipline? Name an organization that has done a great job marketing. What did they do to make you feel this way?

Recall that for a block cipher a key schedule algorithm

Recall that for a block cipher, a key schedule algorithm determines the subkey for each round, based on the key K. Let K = (K0,K1,K2......K55) be a 56-bit DES key. a. List the 48 bits for each of the 16 DES subkeys K1, K ...

System analysis and design1 provide a scenario in which an

System Analysis and Design: 1) Provide a scenario in which an input display screen is inconsistent and explain how both the user and the organization would suffer as a result as a result. 2) Explain how structured walkth ...

1 what is the purpose of exclusive gates such as the xor

1. What is the purpose of exclusive gates such as the XOR and XNOR? 2. What function do these gates perform?

Script kiddies amp code monkeysthese two terms can be

Script Kiddies & Code Monkeys These two terms can be interpreted as derogatory, but they also appear as standard jargon in the workplace. What is a script kiddie? What is a code monkey? What are the differences? Does it ...

Patients are randomly assigned to one of the four treatment

Patients are randomly assigned to one of the four treatment groups to cure a disease: 1) Control 2) Experimental 1 3) Experimental 2 4) Experimental 3 There are 200 patients in the trial; 20 are randomly assigned to the ...

Software reliability quality assurancequestion please refer

Software Reliability Quality Assurance Question please refer below Assume you work for an organisation that develops database products for individuals and small businesses. This organisation is interested in quantifying ...

Assume that the group has a portfolio of 6 stocks there is

Assume that the group has a portfolio of 6 stocks. There is 30% chance that any one of these stocks will increase in value. Find the probability that four of the six stocks increases in value.

C programmingneed help with a c program arrayrearrangec

***C PROGRAMMING*** Need help with a C program array_rearrange.c that rearranges an integer array. The array will be split into two sets of integers one by one. A new array will be created by append the first set to the ...

Show proof of correctness and state and solve the

Show Proof of correctness and state, and solve the Recurrence using the Master Theorem. Let G = G(V, E) be an arbitrary, connected, undirected graph with vertex set V and edge set E. Assume that every edge in E represent ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As