mirror of
https://github.com/tiennm99/java-design-patterns.git
synced 2026-05-14 10:58:42 +00:00
c5a6862887
* sample classes and tests * sample classes and tests * read me addition * fix violations * fix quality (coverage) * fix quality (coverage) #2 * resolved comments
49 lines
1.0 KiB
Java
49 lines
1.0 KiB
Java
package com.iluwatar.table.inheritance;
|
|
|
|
import lombok.Getter;
|
|
import lombok.Setter;
|
|
|
|
/**
|
|
* Represents a generic vehicle with basic attributes like make, model, year, and ID.
|
|
*/
|
|
|
|
@Setter
|
|
@Getter
|
|
public class Vehicle {
|
|
|
|
private String make;
|
|
private String model;
|
|
private int year;
|
|
private int id;
|
|
|
|
/**
|
|
* Constructs a Vehicle object with the given parameters.
|
|
*
|
|
* @param year the year of manufacture
|
|
* @param make the make of the vehicle
|
|
* @param model the model of the vehicle
|
|
* @param id the unique ID of the vehicle
|
|
*/
|
|
public Vehicle(int year, String make, String model, int id) {
|
|
this.make = make;
|
|
this.model = model;
|
|
this.year = year;
|
|
this.id = id;
|
|
}
|
|
|
|
/**
|
|
* Returns a string representation of the vehicle.
|
|
*
|
|
* @return a string with the vehicle's details
|
|
*/
|
|
@Override
|
|
public String toString() {
|
|
return "Vehicle{"
|
|
+ "id=" + id
|
|
+ ", make='" + make + '\''
|
|
+ ", model='" + model + '\''
|
|
+ ", year=" + year
|
|
+ '}';
|
|
}
|
|
}
|