Skip to content

Commit 665aeff

Browse files
Create README.md
1 parent a5d3f26 commit 665aeff

File tree

1 file changed

+65
-0
lines changed

1 file changed

+65
-0
lines changed

README.md

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# Java OOP Task 3
2+
3+
This repository contains Java programs demonstrating Object-Oriented Programming (OOP) concepts, including encapsulation, abstraction, interfaces, and class relationships. The project includes two main tasks: a Library Management System and a Taxable interface implementation for calculating taxes on employees and products.
4+
5+
## Project Structure
6+
7+
- **Book.java**: Defines the `Book` class with attributes `bookID`, `title`, `author`, and `isAvailable` (Task 1).
8+
- **Library.java**: Implements the `Library` class to manage an array of `Book` objects with methods to add, remove, search, and display books (Task 1).
9+
- **Taxable.java**: Defines the `Taxable` interface with constants `salesTax` and `incomeTax`, and an abstract method `calcTax()` (Task 2).
10+
- **Employee.java**: Implements the `Employee` class with the `Taxable` interface to calculate income tax on yearly salary (Task 2).
11+
- **Product.java**: Implements the `Product` class with the `Taxable` interface to calculate sales tax on unit price (Task 2).
12+
- **Main.java**: Contains the main method (likely `DriverMain`) to accept user input for employee and product information and display respective taxes (Task 2).
13+
- **1.a.png, 1.b.png, 1.c.png, 1.d.png, 2.png**: Screenshots of the code implementations for each task.
14+
15+
## Tasks Overview
16+
17+
### Task 1: Library Management System
18+
This task models a library system using OOP principles:
19+
- **Book Class**: Represents a book with attributes `bookID`, `title`, `author`, and `isAvailable`.
20+
- **Library Class**: Manages a collection of books using an array. Provides methods to:
21+
- Add a book to the library.
22+
- Remove a book from the library.
23+
- Search for a book by `bookID`.
24+
- Display all books in the library.
25+
- The system allows user interaction to perform these operations.
26+
27+
### Task 2: Taxable Interface Implementation
28+
This task demonstrates the use of interfaces and abstraction for tax calculations:
29+
- **Taxable Interface**: Defines constants `salesTax = 7%` and `incomeTax = 10.5%`, and an abstract method `calcTax()`.
30+
- **Employee Class**: Implements `Taxable` to calculate income tax on the yearly salary. Attributes include `empId`, `name`, and `salary`.
31+
- **Product Class**: Implements `Taxable` to calculate sales tax on the unit price of a product. Attributes include `pid`, `price`, and `quantity`.
32+
- **DriverMain (Main Class)**: Accepts user input for one employee and one product, then calculates and displays the income tax for the employee and sales tax for the product.
33+
34+
## How to Run
35+
36+
1. **Clone the Repository**:
37+
```bash
38+
git clone https://github.com/thesoulseizure/task-3.git
39+
```
40+
2. **Navigate to the Project Directory**:
41+
```bash
42+
cd task-3
43+
```
44+
3. **Compile the Java Files**:
45+
```bash
46+
javac *.java
47+
```
48+
4. **Run the Program**:
49+
- For Task 1 (Library Management System): The interaction logic is likely in `Library.java` or a separate main method within it. Check the code and run:
50+
```bash
51+
java Library
52+
```
53+
- For Task 2 (Taxable Interface): Run the main class:
54+
```bash
55+
java Main
56+
```
57+
58+
## Requirements
59+
60+
- Java Development Kit (JDK) 8 or higher.
61+
- A terminal or IDE to compile and run Java programs.
62+
63+
## Screenshots
64+
65+
The repository includes screenshots (1.a.png to 1.d.png for Task 1, and 2.png for Task 2) that show the code implementations for each task. Refer to these images to view the solutions visually.

0 commit comments

Comments
 (0)