Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In this assignment you will write a program that will simulate a storage area with collections of items. Items can be added, removed, and

 

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

Step by Step Solution

3.50 Rating (160 Votes )

There are 3 Steps involved in it

Step: 1

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... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Digital Signal Processing

Authors: Jonh G. Proakis, Dimitris G.Manolakis

3rd Edition

978-0133737622, 133737624, 978-013373762

More Books

Students also viewed these Accounting questions

Question

Was the treatment influenced by being novel or disruptive?

Answered: 1 week ago