Question: Now I know the answer to the second part, and I need to know the answer to the third part, and certainly the third part

Now I know the answer to the second part, and I need to know the answer to the third part, and certainly the third part is related to the second part and first part also

Part-III

(Full 50% of your total course grade)


In this last and final part of the course work you are required to change the definition of the Item_in_Stock class to make it an abstract class and change the getItemCat(), getItemName() and getItemDescription() definitions to make them abstract methods.

You are then required to design and implement three classes which are derived from Item_in_Stock class to fully demonstrate the concept of inheritance and polymorphism. Implementation of HP_Laptop class in part II should have given you an idea of inheritance and polymorphism.


Three sub classes, one class against each category (Computers, Laptops and Accessories), should contain appropriate constructors, instance variables, setter and getters methods and overridden methods for getItemName(), getItemDescription() and get_Item_details() method.

You should be creative and come up with your own ideas of sub-classes.


Task 3.1. Draw a UML class diagram with all the classes and relationships.


Task 3.2. Write code in Java with all these classes implementation and a program called Polymorphism_works with member method specific_Item which takes one instance of Item_in_Stock class as a parameter. Perform functionality of adding items, selling items and changing item price and displaying items details against specific item instance. There should be a main () method which declares an array of objects containing instance of sub classes of Item_in_Stock class and then calls methods of each of the implemented classes.


Example.


class polymorphism_works {


public static void specific_Item(Item_in_Stock OBJ){


.

.


.


System.out.println("Item in stock details");

System.out.println(OBJ);


.

.

.


}


public static void main(String[] args) {


Item_in_Stock [] Item_list = new Item_in_Stock [3];



.

.

.


}

}



Testing is an integral part of development. Write suitable test cases in the given format below for your classes.



Test Case

Purpose

Expected result


Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!