SIT771 Object Oriented Development: Stock Management System Java Code

Verified

Added on  2022/10/08

|4
|570
|40
Practical Assignment
AI Summary
This document provides a comprehensive Java code solution for a Stock Management System, designed using Object-Oriented Programming (OOPS) principles. The system includes classes for warehouse management, stock transactions (sales, purchases, adjustments), and individual stock items. The program features a menu-driven interface allowing users to perform various actions. The solution effectively demonstrates core OOPS concepts: abstraction (through abstract classes), encapsulation (using private and protected data), inheritance (in transaction classes), and polymorphism. The document outlines the overall solution structure, the functionality of each class, and how it relates to these key OOPS principles. References to relevant literature are also included. This assignment, part of SIT771, offers a detailed explanation of the code and its design, which aligns with the assignment brief requiring a technical explanation and discussion of the code's functionality and OOPS principles.
Document Page
Programming
Object Oriented Programming with Java
Student Name –
Student ID -
tabler-icon-diamond-filled.svg

Secure Best Marks with AI Grader

Need help grading? Try our AI Grader for instant feedback on your assignments.
Document Page
Stock Management System
Here, the complete Java code has been presented for a Stock Management System using the
concept of OOPS ( Object Oriented Programming).
Description of the overall solution and working:
The class ‘warehouse’ stores the stock items as well as transactions list. The class ‘Stock Sale
Transaction’ stores the stock, price as well as quantity. The class ‘Stock Purchase transaction’
stores the stock, price as well as quantity. The class ‘stock adjustment transaction’ stores the
stock and the quantity. It helps to add or remove the stock. The class ‘stock’ stores the name,
code and quantity in stock for an item. The class ‘transactions’ is an abstract class. In class
‘program’, a menu is displayed and the user is asked to enter an option from 1 - 6 to choose
the desired action to be performed. Based on the option chosen by the user, the desired action
is performed ( using switch statement ).
Relation to key principles of object oriented programming:
Abstraction:
It occurs when only few essential details are shown and other details are hidden from
the user. An abstract class is used for this. It cannot be used for the creation of objects.
In order to access it, it needs to be inherited from any other class.
Document Page
In the given code it is seen as follows: In the abstract class ‘transactions’, certain data
is protected ( like stock, price, quantity) , certain data is private and some data is
public.
Encapsulation:
The data of object can be accessed only through the functions of the object. This
makes the data safe and hides it. It does not allow other objects to cause any changes.
In the given program, at various places the keyword ‘private’ makes the data or
functions accessible only within the class and not outside.
Inheritance:
In case of inheritance, a new class is created ( also called derived class ) from an
already existing class ( also called base class). The derived class has the properties of
the base class as well as its own properties ( Anigbogu, 2011 ).
In the given case, the classes – Stock Adjustment Transaction, Stock Purchase
Transaction and Stock Sale Transaction are inherited from class Transactions.
Polymorphism:
It is said to occur if an operator or a function is used in many ways and forms. It
depends on the data on which they operate ( Ogirima, 2014 ). In the given code, the
functions show polymorphism.
Document Page
References
Anigbogu, S.O., Francisca, O.O. and Usman, K., 2011. An intelligent model for sales and
inventory management. Indian Journal of Computer Science and Engineering, 2(5), pp.785-
791.
Ogirima, S.A.O., Awode, T.R. and Adeosun, O.O., 2014. Online computerized hotel
management system. J. Comput. Biosci. Eng., ISSN, pp.2348-7321.
chevron_up_icon
1 out of 4
circle_padding
hide_on_mobile
zoom_out_icon
logo.png

Your All-in-One AI-Powered Toolkit for Academic Success.

Available 24*7 on WhatsApp / Email

[object Object]