Sale!

Assignment 2 Skills Using Generics

$30.00

Category:

CSC 230 Elementary Data Structures and Algorithms
– Assignment 2

Assignment 2 Skills
Using Generics
Using Inheritance
Assignment 2 Background
Consider the software system from Assignment 1 that models a StoreShelf, and a Product. We would
like to make a couple of modifications to this system.
Create a Generic class Bucket to can store any type of object. The bucket has one data item: the
object to store. The Bucket should have the functionality described:
1. a default constructor.
2. a method addItem that takes 1 parameter: the item to store.
3. a method isEmpty that takes 0 parameters: and return true if the bucket is empty and false if there
is an item stored in it.
We also wish to obtain products that have a limited shelf life. Create a new class PerishableProduct,
that inherits from Product. In addition it should have new member variables called daysOnShelf,
daysToKeep. It should have one constructor that takes 4 parameters: the product name, price, count,
and days to keep.
Assignment 2 Requirements
20% – Write the Bucket class using Generics.
20% – Bucket class has methods described.
20% – Write the PerishableProduct class using Inheritance.
20% – PerishableProduct class has only 1 constructor as specified.
10% – daysOnShelf and daysToKeep are of an appropriate type.
10% – Provide comments where appropriate.
Assignment 2 Submission Submit on Blackboard:
1. Bucket.java
2. PerishableProduct.java
Required Each submitted file should include your name and a statement that this is your own work. This
should appear as a comment at the beginning of any code file.

Reviews

There are no reviews yet.

Be the first to review “Assignment 2 Skills Using Generics”

Your email address will not be published.