Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Part-1 (Only 20% of your total course grade) E-TechMart store in Oman sells different electronics products such as Smart Devices, Home Appliances and Games. The

image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
Part-1 (Only 20% of your total course grade) E-TechMart store in Oman sells different electronics products such as Smart Devices, Home Appliances and Games. The store Management requires an automated software to keep track of items in stock and prices. You as a software designer and developer are asked to develop a system for the store. The first task you should carry out is to design and code a class related to stocked Items. You can name this class as Item_in_Stock. The class should consist of the following: A data member Item_code to store an item code eg. MIO, a data member to store item name, a data member to store item description, a data member to store quantity of items in stock and a data member item_price to store price of an item. You must use the appropriate data types and access specifier for each data member . Class should have a constructor that initialises class objects with specified item_code, quantity and price of items. . Getter and setters methods for all the data members including getItemCato method which returns "Unknown Item Category": getItemName() method which returns the "Unknown Item Name" and getItem Description which retums "Unknown Item Description". These methods will be overridden in later tasks of the assignment to set and display information related to specific items. An add_Item method to add items in stock with a check that item stock does not exceed 120. An appropriate message should be displayed if inserted item exceeds the limit. An item_Sell member method to sell items, method should ask for quantity of selling item and then reduces the stock level accordingly. A tax_on_Item method gives tax on items (Tax is fixed at 5%) A method to set item price without tax and get method to get item price both with and without tax A method named get_Item_Details() that provides Item code, Item Category, Item name, Item description, quantity in stock, and price with and without tax. Task 1.1 Graphically represent above mentioned class in UML by drawing class diagram. Task 1.2. Implementation of the class using Java language. Write a program called Stocked_Item with main () method to test the Item_in_Stock class. Testing is an integral part of development. Write suitable test cases in the given format below for your class. Test Case Purpose Expected result Example OUTPUT: Creating a stock with 10 units Unknown item, price R.O 100 per item, and item code M10 Printing item stock information: Item Category: Unknown Item Category Item Name: Unknown Item Name Description: Unknown Item Description StockCode: M10 Price Without Tax: R.O 100 Price With Tax: R.O 105 Total quantity in store: 10 Adding 10 more items Printing item stock information: Item Category: Unknown Item Category Item Name: Unknown Item Name Description: Unknown Item Description StockCode: M10 Price Without Tax: R. O 100 Price With Tax: R.O 105 Total quantity in store: 20 Sold 2 items Printing item stock information: Item Category: Unknown Item Category Item Name: Unknown Item Name Description: Unknown Item Description StockCode: M10 Price Without Tax: R. O 100 Price With Tax: R.O 105 Total quantity in store: 18 Changing price to R.O 120 Printing item stock information: Item Category: Unknown Item Category Item Name: Unknown Item Name Description: Unknown Item Description StockCode: M10 Price Without Tax: R. O 120 Price With Tax: R. O 126 Total quantity in store: 18 Adding 120 more Items The error: Item stock must not exceed 120 items Part-11 (Only 30% of your total course grade) In this part of the course work, you are required to design and implement a class called Sony TV with instance variables specific to this type of items, a constructor with parameters which initialises class data members and invokes the Item_in_Stock constructor when it is invoked using inheritance concept in java and initialises data members of Item_in_stock class as well. This class should be designed and implemented in a way that it overrides getItemCategory that returns the category of the item, getitemName that returns Sony TV and getItemDescription() that returns "Sony Smart TV 45"". The Class should also override the get_item_details() method to display the complete details of an item. Task 2.1. Re-draw UML class diagram which was drawn in part 1 of the course work with this new class "Sony_TV". Relationships should also be represented. Task 2.2. Implement a class called Item_check with a main method to test Sony TV class by defining object of the class and invoking methods. Testing is an integral part of development. Write suitable test cases in the given format below for your classes. Test Case Purpose Expected result OUTPUT: Refer to output in part 1. item category, item name and item description should be according to the Items. 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 getItem Description() 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 Sony TV class in part II should have given you an idea of inheritance and polymorphism. Three sub classes, one class against each category (Smart Devices, Home Appliances and Games), should contain appropriate constructors, instance variables, setter and getters methods and overridden methods for getItemName(), getItem Description() 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

Step: 1

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

SQL Server Query Performance Tuning

Authors: Sajal Dam, Grant Fritchey

4th Edition

1430267429, 9781430267423

More Books

Students also viewed these Databases questions