Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package vehicle_catalogue;
- public class Vehicle {
- String typeOfVehicle;
- String model;
- String color;
- int horsePower;
- Vehicle(String typeOfVehicle, String model, String color, int horsePower) {
- this.typeOfVehicle = typeOfVehicle;
- this.model = model;
- this.color = color;
- this.horsePower = horsePower;
- }
- public String getModel() {
- return model;
- }
- public int getHorsePower() {
- return horsePower;
- }
- @Override
- public String toString() {
- return String.format("Type: %s%n" + "Model: %s%n"
- + "Color: %s%n" + "Horsepower: %d", this.typeOfVehicle, this.model
- , this.color, this.horsePower);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement