11# Java OOP Foundations
22
3- This repository contains Java programs demonstrating fundamental Object-Oriented Programming (OOP) concepts such as encapsulation, constructors, inheritance, and class design. It includes four foundational tasks (1.1 to 1.4), each focusing on a specific OOP principle.
3+ This repository contains Java programs demonstrating ** Object-Oriented Programming (OOP)** concepts such as encapsulation, constructors, inheritance, and class design.
4+ It includes four tasks (1.1 to 1.4), each implemented using separate Java classes.
45
56---
67
7- ## 📌 Project Structure
8+ ## 📁 Project Structure
89
910```
1011java-oop-foundations/
11- ├── Account.java # Task 1.3 – Account class with deposit/withdraw operations
12- ├── Person.java # Task 1.1 – Basic Person class
13- ├── Person_2.java # Updated/alternate Person version
14- ├── Product.java # Task 1.2 – Product class & product management logic
15- ├── XYZ.java # Task 1.4 – Inheritance example (Person → Employee)
16- ├── screenshots/ # Output/code screenshots for all tasks
12+ ├── Account.java
13+ ├── Person.java
14+ ├── Person_2.java
15+ ├── Product.java
16+ ├── XYZ.java
17+ ├── screenshots/
1718│ ├── 1.1.png
1819│ ├── 1.2.a.png
1920│ ├── 1.2.b.png
@@ -27,49 +28,58 @@ java-oop-foundations/
2728## 📘 Task Overview
2829
2930### ** 🧩 Task 1.1 — Person Class**
30- - Defines a ` Person ` with ` name ` and ` age ` .
31- - Default age is set to ** 18** .
32- - Features:
33- - Constructor initialization
34- - Display method
35- - 📸 Screenshot: ` screenshots/1.1.png `
31+ - Implements a ` Person ` class with:
32+ - ` name ` , ` age `
33+ - Constructor + Display method
34+ - Default age = 18.
35+
36+ 📸 ** Screenshot:**
37+ ![ Task 1.1] ( screenshots/1.1.png )
3638
3739---
3840
39- ### ** 🛒 Task 1.2 — Product Class**
40- - Contains product fields: ` pid ` , ` price ` , ` quantity ` .
41- - Includes a main program that:
42- - Accepts ** 5 products**
43- - Finds the ** highest-priced product**
44- - Calculates ** total spending = price × quantity**
45- - 📸 Screenshots:
46- - ` screenshots/1.2.a.png `
47- - ` screenshots/1.2.b.png `
41+ ### ** 🧩 Task 1.2 — Product Class**
42+ - Defines a ` Product ` class with:
43+ - ` pid ` , ` price ` , ` quantity `
44+ - Includes a main class to:
45+ - Input 5 products
46+ - Find product with highest price
47+ - Calculate total purchase amount
48+
49+ 📸 ** Screenshot A:**
50+ ![ Task 1.2a] ( screenshots/1.2.a.png )
51+
52+ 📸 ** Screenshot B:**
53+ ![ Task 1.2b] ( screenshots/1.2.b.png )
4854
4955---
5056
51- ### ** 🏦 Task 1.3 — Account Class**
52- - Demonstrates encapsulation with:
53- - ` balance ` field
54- - Default & parameterized constructors
55- - ` deposit() ` , ` withdraw() ` , ` displayBalance() `
56- - 📸 Screenshot: ` screenshots/1.3.png `
57+ ### ** 🧩 Task 1.3 — Account Class**
58+ - Balance management using:
59+ - Default constructor
60+ - Parameterized constructor
61+ - Deposit / Withdraw / Display methods
62+
63+ 📸 ** Screenshot:**
64+ ![ Task 1.3] ( screenshots/1.3.png )
5765
5866---
5967
60- ### ** 🧑💼 Task 1.4 — Inheritance (Person → Employee)**
61- - ` Employee ` extends ` Person `
62- - Adds:
63- - ` employeeID `
64- - ` salary `
65- - Uses ` super() ` to initialize parent class data.
66- - 📸 Screenshot: ` screenshots/1.4.png `
68+ ### ** 🧩 Task 1.4 — Inheritance Example**
69+ - ` Person ` = Base class
70+ - ` Employee ` = Derived class
71+ - Uses:
72+ - ` super() ` for constructor chaining
73+ - Additional fields: employeeID, salary
74+
75+ 📸 ** Screenshot:**
76+ ![ Task 1.4] ( screenshots/1.4.png )
6777
6878---
6979
7080## ▶️ Running the Programs
7181
72- ### ** Clone Repository **
82+ ### ** Clone the repository **
7383``` bash
7484git clone https://github.com/TheComputationalCore/java-oop-foundations.git
7585cd java-oop-foundations
@@ -82,33 +92,24 @@ javac *.java
8292
8393### ** Run**
8494``` bash
85- java Person # Task 1.1
86- java Product # Task 1.2
87- java Account # Task 1.3
88- java XYZ # Task 1.4
95+ java Person # Task 1.1
96+ java Product # Task 1.2
97+ java Account # Task 1.3
98+ java XYZ # Task 1.4
8999```
90100
91101---
92102
93103## 🛠 Requirements
94- - ** JDK 8 or higher**
95- - Any Java IDE or terminal with javac
104+ - Java JDK 8 or higher
105+ - Any IDE or terminal that supports Java
96106
97107---
98108
99- ## 🖼 Screenshots
100- Stored inside: ` /screenshots `
101-
102- ```
103- 1.1.png – Person class
104- 1.2.a.png – Product class part A
105- 1.2.b.png – Product class part B
106- 1.3.png – Account class
107- 1.4.png – Inheritance example
108- ```
109+ ## ✔️ Notes
110+ - All tasks are independent and runnable separately.
111+ - Screenshots of all implementations are included in the ` screenshots ` folder.
109112
110113---
111114
112- ## ✔️ Notes
113- This repository focuses on essential OOP concepts and serves as a solid foundation for more advanced Java development.
114-
115+ If you'd like badges, a CI pipeline, or a reorganized folder structure (e.g., ` src/ ` ), just let me know!
0 commit comments