In this assignment you will write a program that will simulate a storage area with collections...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
In this assignment you will write a program that will simulate a storage area with collections of items. Items can be added, removed, and the user can check the value of an item. This assignment does not cover any new material, but is meant to give you a chance to freshen your skills from CSE 110. Requirements Your program must do the following in order to receive full credit on this assignment 1. Create a class called Item a. Each Item has a name and a value in cents. b. These cannot be public 2. Write a default and a regular constructor. a. The regular constructor should take arguments for both instance variables. 3. Write a get for name 4. Write a method which returns the value of the item in dollars and cents. a. What type should this method return? 5. Write a class called Shelf which has an array of items a. It should also track the number of Items currently on this shelf b. Define the maximum number of Items as a constant which is equal to five. 6. Write a single default constructor. a. All shelves start off empty. 7. Write a boolean method that attempts to add a given Item (in the parameter) to this shelf a. It should return true if it was added, false if it was not b. A new Item can't be added if the shelf is full 8. Write a method that returns a String array containing all the names of the Items on this shelf. a. This does not report empty spaces, so if there are only two Items on this shelf, the array will be 2 long b. Return a 0 length array if the shelf is empty In this assignment you will write a program that will simulate a storage area with collections of items. Items can be added, removed, and the user can check the value of an item. This assignment does not cover any new material, but is meant to give you a chance to freshen your skills from CSE 110. Requirements Your program must do the following in order to receive full credit on this assignment 1. Create a class called Item a. Each Item has a name and a value in cents. b. These cannot be public 2. Write a default and a regular constructor. a. The regular constructor should take arguments for both instance variables. 3. Write a get for name 4. Write a method which returns the value of the item in dollars and cents. a. What type should this method return? 5. Write a class called Shelf which has an array of items a. It should also track the number of Items currently on this shelf b. Define the maximum number of Items as a constant which is equal to five. 6. Write a single default constructor. a. All shelves start off empty. 7. Write a boolean method that attempts to add a given Item (in the parameter) to this shelf a. It should return true if it was added, false if it was not b. A new Item can't be added if the shelf is full 8. Write a method that returns a String array containing all the names of the Items on this shelf. a. This does not report empty spaces, so if there are only two Items on this shelf, the array will be 2 long b. Return a 0 length array if the shelf is empty
Expert Answer:
Answer rating: 100% (QA)
1 ITEM CLASS public class Item each item has a name and a value in cents private String name private int value default constructor public Item name va... View the full answer
Related Book For
Digital Signal Processing
ISBN: ?978-0133737622
3rd Edition
Authors: Jonh G. Proakis, Dimitris G.Manolakis
Posted Date:
Students also viewed these accounting questions
-
For this assignment you will write a program that inserts 20 random integers from 0 to 100 in order in a linked list object. The program will create another linked list, but with 15 random integers...
-
write a program that implements a variant of a linked list. This variant has a dummy node pointed to by the head link as shown in the following figure: Linked list with a dummy first node: item next...
-
Keong is considering an investment in Leongs Bar & Grille Corporation. Keong is planning to buy the stock today, hold it for 2 years, and then expects to sell the stock for $30 at the end of 2...
-
Suppose you want to buy a house that is sold by way of a first-price sealed bid auction. In contrast to the model in the lecture, there are more than 2 players. Players simultaneously and...
-
Glycine, an amino acid used by organisms to make proteins, is represented by the following molecular model. (a) Write its molecular formula. (b) Determine its molar mass. (c) Calculate the mass of 3...
-
The following table gives information about the quantity of glasses of lemonade demanded on sunny and overcast days: Plot the data from the table on a graph similar to Figure 1A.5 on page 31. Draw...
-
Comment on the following: An information system is a product.
-
Abbey Park was organized on April 1, 2016, by Trudy Crawford. Trudy is a good manager but a poor accountant. From the trial balance prepared by a part-time bookkeeper Trudy prepared the following...
-
In a thermally isolated environment, you add ice at 0C and steam at 100C. (a) Determine the amount of steam condensed (in g) and the final temperature (in C) when the mass of ice and steam added are...
-
Tires for Less is a franchise of tire stores throughout the greater Northwest. It has projected the following unit sales per tire and costs of tires for the coming year: The company policy is to have...
-
Any University Bookstore is generally a good site to investigate the full range of independent demand inventory decisions. Oftentimes there is a stock out, missing materials, and miscommunication...
-
Oftentimes, managers perceive it as an attractive strategic decision to pursue the acquisition of another company. However, evidence suggests that stock prices of acquiring companies often drop after...
-
Your clients Sabine and Pavel live in a downtown condominium building near the lake. They pay monthly mortgage payments of $2,000 plus a condo fee of $450. They also pay $300 per month in property...
-
Mr. and Mrs. Chen have $200,000 in the bank now generating a guaranteed 4% per year. They will retire 10 years from now and they expect that they will need $40,000 per year during their retirement to...
-
Refining company Sharx Plc., headquartered in the US, is making an investment decision in the Czech Republic as it will be closer to a refinery source. The subsidiary in Czech is expected to generate...
-
What are mutual funds and identify 2 key features of mutual funds...
-
Predict the transition metal-containing products of the following reactions: a. [Mn(CO)] + H_C=CHCH2CH - CO initial product final product b. trans-Ir(CO)CI(PPh3)2 + CH31 c. Ir (PPh3)2Cl d. (n 5-C5H5)...
-
1. As a general strategy, would you recommend that Carl take an aggressive approach to capacity expansion or more of a wait-and-see approach? 2. Should Carl go with the option for one facility that...
-
(a) Determine the autocorrelation of the random sequenceWhere {Ak} are constant amplitudes, {?k} are constant frequencies, and {k} are mutually statistically independent and uniformly distributed...
-
Consider an LTI discrete-time system whose pole-zero patterns is shown in figure (a) Determine the ROC of the system function H(z) if the system is known to be stable. (b) it is possible for given...
-
Quantization error in A/D conversion of a sinusoidal signal ? Let x q (n) be the signal obtained by quantizing the signals x(n) = sin 2? f 0 n.? The quantization error power P q is defined by The...
-
Which of the following statements are hypotheses? (a) Heavier objects fall to Earth faster than lighter ones. (b) The planet Mars is inhabited by invisible beings that are able to elude any type of...
-
A couple in a sport-utility vehicle (SUV) is traveling at 90 km/h on a straight highway. The driver sees an accident in the distance and slows down to 40 km/h in
-
(a) How many significant digits are there in \(403.54 \mathrm{~kg}, 3.010 \times 10^{57} \mathrm{~m}\), \(2.43 \times 10^{-3} \mathrm{~s}, 14.00 \mu \mathrm{m}, 0.0140 \mathrm{~s}, 5300...
Study smarter with the SolutionInn App