Skip to content

Commit d161803

Browse files
Update README.md
1 parent d801ebc commit d161803

File tree

1 file changed

+91
-56
lines changed

1 file changed

+91
-56
lines changed

README.md

Lines changed: 91 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,97 +1,132 @@
1-
# Java OOP Fundamentals
1+
# Java Basics: Control Flow
22

3-
![Java Build](https://github.com/TheComputationalCore/java-oop-fundamentals/actions/workflows/java-build.yml/badge.svg)
3+
![Java Build](https://github.com/TheComputationalCore/java-basics-control-flow/actions/workflows/java-ci.yml/badge.svg)
4+
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](./LICENSE)
45

5-
This repository contains Java programs demonstrating fundamental Object-Oriented Programming (OOP) concepts such as encapsulation, inheritance, and basic class design. It includes four tasks (1.1 to 1.4), each illustrating a different OOP principle.
6+
This repository contains a set of beginner-friendly Java programs demonstrating **control flow**, including looping, branching, number processing, pattern printing, and basic input/output logic.
7+
8+
It includes **7 standalone programs**, each focusing on a fundamental Java concept.
9+
10+
---
611

712
## 📁 Project Structure
13+
814
```
9-
src/
10-
├── Account.java
11-
├── Person.java
12-
├── Person_2.java
13-
├── Product.java
14-
├── XYZ.java
15-
└── screenshots/
16-
├── 1.1.png
17-
├── 1.2.a.png
18-
├── 1.2.b.png
19-
├── 1.3.png
20-
└── 1.4.png
15+
java-basics-control-flow/
16+
├── src/
17+
│ ├── PrintNumberRange.java
18+
│ ├── CheckNumberSign.java
19+
│ ├── ReverseNumber.java
20+
│ ├── FindSmallestOfThree.java
21+
│ ├── DiscountCalculator.java
22+
│ ├── NumberPatternGenerator.java
23+
│ ├── NumberPatternGeneratorAlt.java
24+
├── screenshots/
25+
│ ├── printnumrange.png
26+
│ ├── numcheck.png
27+
│ ├── reversenum.png
28+
│ ├── smallnum.png
29+
│ ├── discountcal.png
30+
│ ├── pattern.png
31+
├── LICENSE
32+
└── README.md
2133
```
2234

23-
## 📝 Task Overviews
35+
---
36+
37+
## 📝 Program Overviews
2438

25-
### **Task 1.1 — Person Class**
26-
- Implements a `Person` class with `name` and `age`.
27-
- Default age is **18**.
28-
- Includes constructor + method to display info.
39+
### **1️⃣ PrintNumberRange.java**
40+
Prints numbers from **10 to 50** using a loop.
2941

30-
▶️ **Screenshot:**
31-
![1.1](screenshots/1.1.png)
42+
📸 Screenshot:
43+
![Print Number Range](screenshots/printnumrange.png)
3244

3345
---
3446

35-
### **Task 1.2 — Product Class**
36-
- Represents products with `pid`, `price`, and `quantity`.
37-
- `ProductMain`:
38-
- Accepts **5 products**.
39-
- Finds **highest price product**.
40-
- Calculates **total expenditure**.
47+
### **2️⃣ CheckNumberSign.java**
48+
Checks whether a number is **positive** or **negative**.
4149

42-
▶️ **Screenshots:**
43-
![1.2a](screenshots/1.2.a.png)
44-
![1.2b](screenshots/1.2.b.png)
50+
📸 Screenshot:
51+
![Number Sign Check](screenshots/numcheck.png)
4552

4653
---
4754

48-
### **Task 1.3 — Account Class**
49-
- Implements `deposit`, `withdraw`, and `display` methods.
50-
- Includes default + parameterized constructors.
55+
### **3️⃣ ReverseNumber.java**
56+
Reverses digits in a number
57+
Example: `876 → 678`
5158

52-
▶️ **Screenshot:**
53-
![1.3](screenshots/1.3.png)
59+
📸 Screenshot:
60+
![Reverse Number](screenshots/reversenum.png)
5461

5562
---
5663

57-
### **Task 1.4 — Inheritance (Person → Employee)**
58-
- `Employee` extends `Person`.
59-
- Adds `employeeID` and `salary`.
60-
- Uses `super()` for parent initialization.
64+
### **4️⃣ FindSmallestOfThree.java**
65+
Inputs three numbers and prints the **smallest**.
6166

62-
▶️ **Screenshot:**
63-
![1.4](screenshots/1.4.png)
67+
📸 Screenshot:
68+
![Smallest of Three](screenshots/smallnum.png)
69+
70+
---
71+
72+
### **5️⃣ DiscountCalculator.java**
73+
Applies a discount based on purchase amount:
74+
75+
| Amount Range | Discount |
76+
|--------------|----------|
77+
| < 500 | 0% |
78+
| 500–1000 | 10% |
79+
| > 1000 | 20% |
80+
81+
📸 Screenshot:
82+
![Discount Calculator](screenshots/discountcal.png)
83+
84+
---
85+
86+
### **6️⃣ NumberPatternGenerator.java**
87+
Prints a number-based pattern using loops.
88+
89+
📸 Screenshot:
90+
![Pattern](screenshots/pattern.png)
91+
92+
---
93+
94+
### **7️⃣ NumberPatternGeneratorAlt.java**
95+
Alternative implementation of the number pattern.
6496

6597
---
6698

6799
## ▶️ Running the Programs
68100

69-
### **1. Clone the Repository**
101+
### Clone Repository
70102
```bash
71-
git clone https://github.com/TheComputationalCore/java-oop-fundamentals.git
72-
cd java-oop-fundamentals/src
103+
git clone https://github.com/TheComputationalCore/java-basics-control-flow.git
104+
cd java-basics-control-flow/src
73105
```
74106

75-
### **2. Compile**
107+
### Compile All Programs
76108
```bash
77109
javac *.java
78110
```
79111

80-
### **3. Run (examples)**
112+
### Run a Specific Program
81113
```bash
82-
java Person
83-
java Product
84-
java Account
85-
java XYZ
114+
java PrintNumberRange
115+
java CheckNumberSign
116+
java ReverseNumber
117+
java FindSmallestOfThree
118+
java DiscountCalculator
119+
java NumberPatternGenerator
86120
```
87121

88122
---
89123

90-
## 📦 Requirements
91-
- Java JDK **8 or higher**
92-
- Any terminal or Java IDE
124+
## 🛠 Requirements
125+
- Java **JDK 8 or higher**
126+
- Any Java IDE or terminal
93127

94128
---
95129

96-
## 📄 License
97-
This project is licensed under the MIT License.
130+
## 📄 License
131+
This project is licensed under the **MIT License**.
132+

0 commit comments

Comments
 (0)