Skip to content

Latest commit

 

History

History
62 lines (47 loc) · 3.7 KB

File metadata and controls

62 lines (47 loc) · 3.7 KB

Java — Object-Oriented Programming Practice

A collection of small Java console applications built to practice core Object-Oriented Programming (OOP) concepts. Each folder is a standalone project covering a different real-world scenario — from banking to e-commerce — while reinforcing fundamentals like encapsulation, constructors, method overloading, and inheritance.

Projects

1. bank/ — Savings Account System

  • Classes: SavingsAccount, BankApp
  • Concepts: Encapsulation (private fields with getters/setters), input validation (deposit/withdrawal amount checks), constructor initialization with default fallback for invalid deposits.

2. booklanding/ — Library Management

  • Classes: LibraryBook, LibraryApp
  • Concepts: Encapsulation, object instantiation, business-rule methods (lendBook checks copy availability before issuing).

3. course/ — Course Fee Calculator

  • Classes: Course (base), RegularCourse (extends Course), PremiumCourse (extends Course), CourseApp
  • Concepts: Inheritance, method overriding (calculateTotalFee(), displayCourseDetails()), method overloading (calculateTotalFee(discountPercentage)), use of super() to call parent constructors and parent methods, protected access modifiers for subclass access.

4. devoloper/ — Employee Payroll System

  • Classes: Employee, EmpolyeeApp
  • Concepts: Encapsulation, conditional bonus logic based on performance rating, Scanner-based interactive user input with validation loop (do-while).

5. Driver/ — Driver Salary & Bonus System

  • Classes: Driver, DriverApp
  • Concepts: Constructor overloading (three different constructors for different initialization scenarios), method overloading (calculateBonus() vs calculateBonus(customScore)), private helper methods (getBonusRate), input-safe setters using switch for score validation.

6. e_commerce/ — Product Pricing System

  • Classes: Product, ProductApp
  • Concepts: Constructor overloading (three variants), method overloading (calculateFinalPrice() vs calculateFinalPrice(seasonalDiscount)), encapsulation with validated setters (setMembershipType restricts to allowed values), layered discount calculation logic.

7. ArrayList/ — Movie Rental Shop

  • Classes: Movie, MovieRentalShop
  • Concepts: Java Collections (ArrayList), Iterator for safe removal while looping, dynamic object management (add/remove/search), interactive Scanner-driven catalog builder.

Core OOP Concepts Demonstrated

Concept Where
Encapsulation All projects (private fields + public getters/setters)
Constructor Overloading Driver, Product, Course
Method Overloading Driver, Course, Product
Inheritance course/ (CourseRegularCourse, PremiumCourse)
Polymorphism (Method Overriding) course/ (calculateTotalFee(), displayCourseDetails())
super keyword usage course/ package
Collections & Iterators ArrayList/ (Movie Rental Shop)
Input Validation bank/, Driver/, e_commerce/, devoloper/

🛠️ Tech Stack

  • Language: Java
  • Concepts: Core Java, OOP (Encapsulation, Inheritance, Polymorphism, Overloading)
  • I/O: java.util.Scanner for interactive console input

Running a Project

Each project has its own App class with a main method. Compile and run any project individually, for example:

javac course/*.java
java course.CourseApp

Purpose

This repository was built to strengthen practical understanding of Java OOP principles through hands-on, scenario-based mini-projects rather than isolated syntax exercises.