Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package Exercise.O6Exercise;
- public class Vehicle {
- private String type;
- private String model;
- private String color;
- private int horsePower;
- public String getType() {
- return type;
- }
- public void setType(String type) {
- this.type = type;
- }
- public String getModel() {
- return model;
- }
- public void setModel(String model) {
- this.model = model;
- }
- public String getColor() {
- return color;
- }
- public void setColor(String color) {
- this.color = color;
- }
- public int getHorsePower() {
- return horsePower;
- }
- public void setHorsePower(int horsePower) {
- this.horsePower = horsePower;
- }
- @Override
- public String toString() {
- return String.format("Type: %s\n" +
- "Model: %s\n" +
- "Color: %s\n" +
- "Horsepower: %d", getType().toUpperCase().charAt(0) + this.getType().substring(1), getModel(), getColor(), getHorsePower());
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment