Folders and files
| Name | Name | Last commit date | ||
|---|---|---|---|---|
Repository files navigation
# Employee Income Management
A console application developed in **C#** to practice **Object-Oriented Programming (OOP)** concepts, with a focus on **composition, classes, enumerations, collections, date manipulation, and LINQ**.
The application allows users to register an employee, associate them with a department, add hourly contracts, and calculate their income for a specific month and year.
---
## 📌 About the Project
This project was developed as part of my studies in **C# and Object-Oriented Programming**.
The main goal is to understand how different objects can work together to represent a real-world scenario.
The application models the relationship between:
* An employee (`Worker`)
* A department (`Department`)
* Multiple hourly contracts (`HourContract`)
* An employee level (`WorkerLevel`)
The project uses **composition** to establish these relationships.
---
## 🚀 Features
* 👤 Employee registration
* 🏢 Department association
* 🎯 Employee level classification
* 📄 Hourly contract registration
* 📅 Contract date management
* 💰 Hourly contract income calculation
* 📊 Monthly employee income calculation
* 🔎 Contract filtering by month and year
* 🧩 Object composition
* 📋 Collection management using `List<T>`
---
## 🧠 Concepts Practiced
This project focuses on fundamental **C# and Object-Oriented Programming** concepts:
* Classes and objects
* Encapsulation
* Properties
* Constructors
* Methods
* Enumerations (`enum`)
* Object composition
* Associations between objects
* Collections with `List<T>`
* Date and time manipulation with `DateTime`
* LINQ
* Conditional logic
* Separation of responsibilities
* Console input/output
---
## 🏗️ Project Structure
```text
EmployeeIncomeManagement
│
├── Entities
│ ├── Enums
│ │ └── WorkerLevel.cs
│ │
│ ├── Department.cs
│ ├── HourContract.cs
│ └── Worker.cs
│
├── Program.cs
├── EmployeeIncomeManagement.csproj
└── README.md
```
### `Worker`
Represents the employee and contains information such as:
* Name
* Employee level
* Base salary
* Department
* Hourly contracts
### `Department`
Represents the department associated with the employee.
### `HourContract`
Represents an hourly employment contract.
Each contract contains:
* Date
* Value per hour
* Duration in hours
The contract can calculate its total value based on the hourly rate and the number of hours worked.
### `WorkerLevel`
An enumeration that represents the employee's professional level:
```text
Junior
MidLevel
Senior
```
### `Program`
Responsible for interacting with the user, collecting input data, and executing the application's main flow.
---
## 🔗 Object Composition
One of the main concepts practiced in this project is **composition**.
A `Worker` contains a `Department` and a collection of `HourContract` objects.
```text
┌─────────────────┐
│ Worker │
│ │
│ Name │
│ Level │
│ BaseSalary │
└────────┬────────┘
│
┌────────┴────────┐
│ │
▼ ▼
┌─────────────────┐ ┌─────────────────┐
│ Department │ │ Hour Contracts │
│ │ │ │
│ Name │ │ HourContract │
└─────────────────┘ └────────┬────────┘
│
┌─────────┼─────────┐
▼ ▼ ▼
Contract Contract Contract
```
This structure demonstrates how objects can be combined to represent more complex entities.
---
## 💻 Example
### Input
```text
Enter department's name: Design
Enter worker data:
Name: Alex
Level (Junior/MidLevel/Senior): MidLevel
Base salary: 1200.00
How many contracts to this worker? 3
Enter #1 contract data:
Date (DD/MM/YYYY): 20/08/2018
Value per hour: 50.00
Duration (hours): 20
Enter #2 contract data:
Date (DD/MM/YYYY): 13/06/2018
Value per hour: 30.00
Duration (hours): 18
Enter #3 contract data:
Date (DD/MM/YYYY): 25/08/2018
Value per hour: 80.00
Duration (hours): 10
Enter month and year to calculate income (MM/YYYY): 08/2018
```
### Output
```text
Name: Alex
Department: Design
Income for 08/2018: 3000.00
```
### Calculation
The employee's income for August 2018 is calculated using the base salary and contracts performed during that month.
```text
Base salary: R$ 1,200.00
Contract #1: 20 × R$ 50.00 = R$ 1,000.00
Contract #3: 10 × R$ 80.00 = R$ 800.00
───────────
Total income: R$ 3,000.00
```
The contract from June 2018 is not included because the selected period is August 2018.
---
## 🛠️ Technologies
* **C#**
* **.NET**
* **LINQ**
* **Git**
* **GitHub**
* **Visual Studio / Visual Studio Code**
---
## ⚙️ Requirements
Before running the project, make sure you have installed:
* [.NET SDK](https://dotnet.microsoft.com/download)
* Git
* Visual Studio, Visual Studio Code, or another compatible IDE
---
## ▶️ How to Run
Clone the repository:
```bash
git clone https://github.com/lucasferreira31/employee-income-management.git
```
Navigate to the project directory:
```bash
cd employee-income-management
```
Restore the project dependencies:
```bash
dotnet restore
```
Run the application:
```bash
dotnet run
```
---
## 📚 What I Learned
Through this project, I practiced how to model a real-world problem using **Object-Oriented Programming**.
The main learning points were:
* How to create and organize entities using classes;
* How to use composition to establish relationships between objects;
* How to work with collections of objects;
* How to use enumerations to represent fixed values;
* How to manipulate dates with `DateTime`;
* How to filter collections using LINQ;
* How to separate responsibilities between classes;
* How to structure a C# console application.
---
## 🔮 Future Improvements
Possible improvements for future versions of the project:
* [ ] Add input validation
* [ ] Add exception handling
* [ ] Create automated unit tests with xUnit
* [ ] Improve application error messages
* [ ] Add persistence with Entity Framework Core
* [ ] Integrate SQL Server
* [ ] Create a REST API using ASP.NET Core
* [ ] Add Swagger/OpenAPI documentation
* [ ] Add CI/CD with GitHub Actions
---
## 📂 Project Files
| File | Description |
| ----------------- | ---------------------------------------------- |
| `Worker.cs` | Represents the employee |
| `Department.cs` | Represents the employee's department |
| `HourContract.cs` | Represents an hourly contract |
| `WorkerLevel.cs` | Defines the employee's professional level |
| `Program.cs` | Contains the application's main execution flow |
---
## 🎯 Project Goal
The purpose of this project is to strengthen my foundation in **C# and Object-Oriented Programming** as part of my journey toward becoming a professional **.NET developer**.
The project focuses on understanding the fundamentals before moving into more advanced technologies such as:
```text
C#
↓
Object-Oriented Programming
↓
Unit Testing
↓
Entity Framework Core
↓
SQL Server
↓
ASP.NET Core
↓
REST APIs
```
---
## 👨💻 Author
**Lucas Ferreira Machado**
C# / .NET Developer in training, focused on backend development, APIs, databases, and software engineering fundamentals.
### Connect with me
* GitHub: [lucasferreira31](https://github.com/lucasferreira31)
* LinkedIn: [Lucas Ferreira Machado](https://www.linkedin.com/in/lucas-ferreira-machado-96193427a/)
---
⭐ If you found this project useful or interesting, feel free to star the repository!