https://github.com/nav773/vehicleandcarproject
https://github.com/nav773/vehicleandcarproject
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/nav773/vehicleandcarproject
- Owner: nav773
- Created: 2024-08-31T04:38:04.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-09-02T01:29:32.000Z (almost 2 years ago)
- Last Synced: 2025-07-09T12:11:34.556Z (12 months ago)
- Language: Java
- Size: 8.79 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Vehicle and Car Java Project
## Overview
This project demonstrates the creation of a basic Java class hierarchy with a `Vehicle` class and a `Car` class. The `Car` class extends `Vehicle` and includes additional attributes and methods.
## Project Structure:
- **Vehicle.java**: Defines a `Vehicle` class with attributes `numberOfWheels`, `color`, `engineSize`, and `fuelType`.
- **Car.java**: Extends `Vehicle`, adding the `brand` attribute and methods like `honk()` and `displayInfo()`.
- **Main.java**: Contains the `main` method to test the classes by creating instances of `Vehicle` and `Car` and invoking their methods.
## Example Output
- Honk, honk!
- Car Details:
- Brand: Volvo
- Number of Wheels: 4
- Color: Yellow
- Engine Size: 2.5 liters
- Fuel Type: Petrol
## How to Run
## Prerequisites:
- **IntelliJ IDEA**: Ensure that IntelliJ IDEA is installed on your system.
- **Java SDK**: Make sure Java SDK is installed and configured.
## Project Files:
- Vehicle.java: Defines the Vehicle class with attributes for general vehicle properties.
- Car.java: Defines the Car class, extending Vehicle with additional attributes and methods specific to cars.
- Main.java: Provides a main method for testing the classes, creating instances, and invoking methods.
- README.md: This file, providing an overview and detailed instructions for the project.