Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.michaelwalker;
- public class Vehicle {
- private String engine;
- private String chassis;
- private String year;
- private int numWheels;
- private long weight;
- private int horsePower;
- private int torque;
- private int maxSpeed;
- private int maxRpm;
- private double kmDriven;
- public Vehicle(String engine, String chassis, String year, int numWheels, long weight) {
- this(engine, chassis, year, numWheels, weight, 80, 369, 180, 5000, 0);
- }
- private Vehicle(String engine, String chassis, String year, int numWheels, long weight, int horsePower, int torque, int maxSpeed, int maxRpm, double kmDriven) {
- this.engine = engine;
- this.chassis = chassis;
- this.year = year;
- this.numWheels = numWheels;
- this.weight = weight;
- this.horsePower = horsePower;
- this.torque = torque;
- this.maxSpeed = maxSpeed;
- this.maxRpm = maxRpm;
- this.kmDriven = kmDriven;
- }
- public void write() {
- System.out.println("---SPECS---");
- System.out.println("engine : " + getEngine());
- System.out.println("chassis : " + getChassis());
- System.out.println("year : " + getYear());
- System.out.println("numWheels : " + getNumWheels());
- System.out.println("Weight : " + getWeight());
- System.out.println("horsePower : " + getHorsePower());
- System.out.println("torque : " + getTorque());
- System.out.println("maxSpeed : " + getMaxSpeed());
- System.out.println("kmDriven : " + getKmDriven());
- }
- public long getWeight() {
- return weight;
- }
- public String getEngine() {
- return engine;
- }
- public String getChassis() {
- return chassis;
- }
- public String getYear() {
- return year;
- }
- public int getNumWheels() {
- return numWheels;
- }
- public int getHorsePower() {
- return horsePower;
- }
- public int getTorque() {
- return torque;
- }
- public int getMaxSpeed() {
- return maxSpeed;
- }
- public int getMaxRpm() {
- return maxRpm;
- }
- public double getKmDriven() {
- return kmDriven;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement