OOP Fundamentals Suite

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.

Table of Contents

  1. Introduction
  2. Project Overview
  3. Getting Started
  4. Classes Overview
    1. Area Calculator Classes
    2. RoomCarpet and RoomDimension Classes
    3. LandTract Class
    4. Month Class
    5. CashRegister and RetailItem Classes
    6. Car Instrument Simulator
    7. First to One Game
  5. Learning Objectives
  6. Future Enhancements
  7. Contributing
  8. License

Overview

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.

Project Contents

1. Area Calculator Classes

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.

2. RoomCarpet and RoomDimension Classes

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.

3. LandTract Class

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.

4. Month Class

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.

5. CashRegister and RetailItem Classes

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.

6. Car Instrument Simulator

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.

7. First to One Game

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.

Getting Started

Prerequisites

  • Java Development Kit (JDK) installed on your system.
  • A Java IDE (like IntelliJ IDEA, Eclipse, or VS Code) for writing and running the code.

Running the Programs

  1. Clone or download this repository to your local machine.
  2. Open each Java file in your preferred Java IDE.
  3. Compile and run the main class of each project (e.g., FirstToOneGame.java, CarInstrumentSimulator.java).
  4. Follow the on-screen prompts for each program to see how they work.

Learning Objectives

  • 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.

Future Enhancements

  • 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.

Contributing

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!

License

This project is licensed under the MIT License - see the LICENSE file for details.