Welcome to the OOP Fundamentals Suite! This project folder contains a collection of Java programs designed to introduce and reinforce key Object-Oriented Programming (OOP) concepts. Each program demonstrates different aspects of OOP, including class creation, encapsulation, inheritance, and interactions between objects.
- Introduction
- Project Overview
- Getting Started
- Classes Overview
- Learning Objectives
- Future Enhancements
- Contributing
- License
The purpose of this suite is to provide hands-on experience with the basic building blocks of OOP in Java. These exercises focus on creating reusable, well-structured classes and demonstrating how objects interact in various real-world simulations and problem-solving scenarios.
Description: Implements overloaded static methods in a Geometry class to calculate the area of different shapes: circles, rectangles, and triangles. This project showcases the use of static methods and method overloading.
Concepts Covered: Method overloading, static methods, encapsulation.
Description: Models the dimensions of a room and calculates the total cost of carpeting it using RoomCarpet and RoomDimension classes. This project demonstrates the use of composition and the interaction between objects.
Concepts Covered: Composition, encapsulation, constructors.
Description: Simulates a land tract with length and width attributes. Includes methods to calculate the area, compare equality between land tracts, and provide a string representation.
Concepts Covered: Encapsulation, equals method, toString method.
Description: Represents a month using different constructors (integer and string) and provides various utility methods, including comparison (equals, greaterThan, lessThan) and string conversion.
Concepts Covered: Overloaded constructors, encapsulation, custom comparison methods.
Description: Simulates a retail transaction using the CashRegister class to calculate the subtotal, tax, and total cost based on a RetailItem object. Also demonstrates writing a sales receipt to a file.
Concepts Covered: Object interaction, file I/O, encapsulation.
Description: Simulates a car's fuel gauge and odometer using the FuelGauge and Odometer classes. The odometer decreases fuel as the car travels, showcasing interaction between objects and simulating real-world behavior.
Concepts Covered: Object interaction, encapsulation, simulation of real-world systems.
Description: Implements a two-player game where players roll a die to decrement their points until one player reaches exactly 1 point. This project introduces game logic and demonstrates object interaction.
Concepts Covered: Class interaction, game logic, randomness.
- Java Development Kit (JDK) installed on your system.
- A Java IDE (like IntelliJ IDEA, Eclipse, or VS Code) for writing and running the code.
- Clone or download this repository to your local machine.
- Open each Java file in your preferred Java IDE.
- Compile and run the main class of each project (e.g.,
FirstToOneGame.java
,CarInstrumentSimulator.java
). - Follow the on-screen prompts for each program to see how they work.
- Understand how to create and use classes in Java.
- Learn the principles of encapsulation, method overloading, and object interaction.
- Gain hands-on experience with real-world simulations using OOP concepts.
- Explore file I/O operations and how to generate output in Java.
- Add more classes to simulate other real-world scenarios using OOP principles.
- Expand the existing projects to include more complex interactions, such as inheritance and polymorphism.
- Implement graphical user interfaces (GUIs) for some projects to enhance user interaction.
If you have suggestions for additional projects or ways to enhance the current ones, feel free to fork this repository and submit a pull request. All contributions are welcome!
This project is licensed under the MIT License - see the LICENSE file for details.