Skip to content

anaglodariu/Inventory

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Inventory Project

Overview

This is an inventory program that can be used for storing CDs and DVDs. The language used for the program is Object-Oriented Programming, therefore there are 2 classes:

  • the driver class: ProductTester, which is in charge of running the object class
  • the object class: Product
  • 2 subclasses of the Product superclass: DVD and CD

Features

  • Adding products to the inventory depending on its type
  • Viewing products that are stored
  • Add to/Remove from the number of units in stock for a certain product
  • Discontinue product sale
  • Implementing a user interface: a MENU the user can choose from what changes to apply to the inventory

OOP concepts used

  • Abstraction: the Product class is abstract to avoid creating pure Product objects, only DVD and CD objects are needed.
  • Encapsulation: in the Product class the instance fields are declared as private.
  • Inheritance: by creating subclasses of the Product class; the DVD and CD subclasses inherit the public methods/getters/setters from the Product parent class, the fields from the superclass are not inherited because they are private, but they can be accessed through the public getters.
  • Polymorphism: when creating CD or DVD objects instead of a generic product object; DVD and CD subclasses define their own unique behaviours (overriding methods: getInventoryValue, toString) and yet share some of the same functionality of the Product class. Also, Dynamic Method Dispatch is the mechanism by which a call to an overridden method is resolved at run time, rather than compile time. At run time, it depends on the type of the object being referred to (not the type of the reference variable)

Other concepts used

  • The use of static methods in the driver class in order to make the code more modular, easier to read and understand

Inspiration

This personal project was inspired by the JF Java Fundamentals Learner course on ORACLE Academy. It was made for learning purposes.

Source Material

How to compile and run the project in terminal

  • For compiling the project use command in terminal from the src directory:
    javac inventory/ProductTester.java inventory/Product.java
  • For running the project use command in terminal from the src directory:
    java inventory.ProductTester

About

Inventory program for storing CDs and DVDs

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages