Welcome to the RentACar Platform repository! ππ» This system simulates a car rental service, showcasing key programming principles through a simple and user-friendly interface.
The RentACar Platform is a console-based project designed to illustrate key programming concepts such as Object-Oriented Programming (OOP) principles, including encapsulation, inheritance, and polymorphism. π οΈπ The system leverages classes to manage users and vehicles, implements data validation mechanisms, and utilizes collections for efficient data handling. It serves as a practical example for learning how to structure code, enforce data integrity, and create dynamic user interactions in a clean and modular way. β¨
using System;
using System.Collections.Generic;
using System.Linq;
These namespaces provide essential functionalities like console input/output, collections, and LINQ operations.
- Purpose: Entry point of the application.
- Actions:
- Calls
InsertCars()
to populate the car list. - Prints a welcome message via
StartMessagePrint()
. - Directs the user to select their role and functionalities with
ChooseFunction()
.
- Calls
- Purpose: Creates a list of 10 randomly generated cars with properties:
- Brand, Model, Color, Year, Price, Availability.
- Details:
- Uses
Random
to select random values from predefined arrays. - Each car is added to the
cars
list.
- Uses
- Purpose: Differentiates between Admin and Regular User roles.
- Options:
- Register as a User.
- Register as an Admin (
isAdmin = true
).
- Purpose: Collects user details and initializes a new user profile.
- Details:
- Prompts for name, password, and money.
- Stores user information in the
currentUser
variable.
- Purpose: Displays menu options for users or admins.
- Options:
- Admin:
- Add/Delete cars.
- View or modify car details.
- Exit.
- User:
- Rent/Return cars.
- View available cars.
- Calculate rent prices.
- Admin:
- Add a Car: Adds a new car with user-provided details.
- Delete a Car: Removes a car by its brand and model.
- View All Cars: Lists all cars in the system.
- Modify Car Details: Changes attributes like brand, model, price, etc.
- Rent a Car: Deducts the rental cost from user balance and marks the car as unavailable.
- Return a Car: Returns a car and marks it as available.
- Calculate Rent Price: Displays the cost for renting a car for a specified duration.
- View Available Cars: Lists all cars currently available for rent.
- Purpose: Common functionality for
User
andAdmin
. - Key Methods:
ViewAvailableCars()
: Displays all available cars.CheckIndexIsValid()
: Ensures valid indices for cars.IsCarAlreadyInTheSystem()
: Prevents duplicate car entries.FindCarIndex()
: Finds a car by brand and model.
- Attributes:
- Name, Password, Money.
- Key Methods:
RentACar()
: Handles car rental logic.ReturnACar()
: Manages car return functionality.CalculatePrice()
: Estimates the total rent cost.
- Key Methods:
AddCar()
: Adds a car to the system.DeleteCar()
: Removes a specific car.ChangeCarDetails()
: Updates car attributes.
- Attributes:
- Brand, Model, Color, Year, Price, Availability.
- Purpose: Represents a car entity in the system.
- Graceful exit from the application when the user chooses option
99
.
- Role-Based Access: Separate menus and functionalities for admins and users.
- Robust Input Handling: Ensures valid user input with retries.
- Data Management: Maintains a dynamic list of cars with search and validation features.
- π Enhance security with encrypted passwords.
- π Add a reporting system for rented cars.
- π Implement a GUI for a better user experience.
- C# .NET: For backend logic and OOP implementation π₯οΈ
- Visual Studio: IDE used for development π¨βπ»
- Lists: For storing user accounts, transactions, and loans π
-
Clone the Repository:
git clone https://github.com/KadirYazadzhi/SoftUni---RentACarPlatform.git
-
Open the Project:
- Open project in your IDE.
-
Run the Application:
- The program will prompt you to create a new account or log in.
- Choose an action such as depositing money, viewing balance, or applying for a loan.
-
Exit the Program:
- Type "exit" to close the application after you're done.
-
Pre-requisites: Make sure you have the following installed on your system:
-
Running Locally:
- Clone the repository using the command:
git clone https://github.com/KadirYazadzhi/SoftUni---RentACarPlatform.git
- Open the project in Visual Studio.
- Build and run the project.
- Clone the repository using the command:
This project is based on the "RentACar Platform" exercise created by Mario Zahariev for Python developers. However, I adapted the task and implemented it in C#. You can view the original task here.
Special thanks to Mario Zahariev for providing a great foundational exercise.
Feel free to fork this repository and submit pull requests! Contributions are welcome if you have ideas for additional patterns, new features, or improved functionality.
If you have any questions or suggestions, feel free to reach out at:
- π§ Email: [email protected]
- π Portfolio: Kadir Yazadzhi