Array of ItemType objects
Array of ItemType objects
Kudos, your application is progressing really good but its time to add some really
cool features to it. Until now you have created single objects for each class, now
there's a need to create an array of objects for a class to enable the search
feature. Create an array of ItemType objects. Also, add a provision for adding a
new ItemType object to the array of ItemType objects. Create an interactive console
to get input from the user for performing different actions on the array.
Attributes Datatype
name String
deposit Double
costPerDay Double
Include appropriate getters and setters for the class.
Include appropriate constructor(s) for the class.
Create a class named ItemTypeBO class and include the following methods.
Method Description
public void add(ItemType object ,ItemType[] itemTypeArray,Integer index) This
method accepts an array of ItemType objects, an ItemType object and the
index at which the object is to be added.
The method appends the object to the array of ItemType objects at the specified
index and prints
"New item added successfully"
public void search(String search, ItemType[] itemTypeArray)This method accepts the
search term and the array of ItemType objects as input.
It displays the details of the ItemType if matched. else prints "Searched Item Type
not found"
public void display(ItemType[] itemTypeArray) This method accepts an array of
ItemType objects as arguments.
It displays the details one by one.
Create a driver class called Main. In the Main method, obtain input from the user
and call the ItemTypeBO functions appropriately.