Advertisement
Guest User

Vehicle.java

a guest
Apr 25th, 2018
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.29 KB | None | 0 0
  1. package com.michaelwalker;
  2.  
  3. public class Vehicle {
  4.  
  5.     private String engine;
  6.     private String chassis;
  7.     private String year;
  8.     private int numWheels;
  9.     private long weight;
  10.  
  11.     private int horsePower;
  12.     private int torque;
  13.     private int maxSpeed;
  14.     private int maxRpm;
  15.  
  16.     private double kmDriven;
  17.  
  18.     public Vehicle(String engine, String chassis, String year, int numWheels, long weight) {
  19.         this(engine, chassis, year, numWheels, weight, 80, 369, 180, 5000, 0);
  20.     }
  21.  
  22.     private Vehicle(String engine, String chassis, String year, int numWheels, long weight, int horsePower, int torque, int maxSpeed, int maxRpm, double kmDriven) {
  23.         this.engine     = engine;
  24.         this.chassis    = chassis;
  25.         this.year       = year;
  26.         this.numWheels  = numWheels;
  27.         this.weight     = weight;
  28.         this.horsePower = horsePower;
  29.         this.torque     = torque;
  30.         this.maxSpeed   = maxSpeed;
  31.         this.maxRpm     = maxRpm;
  32.         this.kmDriven   = kmDriven;
  33.     }
  34.  
  35.     public void write() {
  36.         System.out.println("---SPECS---");
  37.         System.out.println("engine     : " + getEngine());
  38.         System.out.println("chassis    : " + getChassis());
  39.         System.out.println("year       : " + getYear());
  40.         System.out.println("numWheels  : " + getNumWheels());
  41.         System.out.println("Weight     : " + getWeight());
  42.         System.out.println("horsePower : " + getHorsePower());
  43.         System.out.println("torque     : " + getTorque());
  44.         System.out.println("maxSpeed   : " + getMaxSpeed());
  45.         System.out.println("kmDriven   : " + getKmDriven());
  46.     }
  47.  
  48.     public long getWeight() {
  49.         return weight;
  50.     }
  51.  
  52.     public String getEngine() {
  53.         return engine;
  54.     }
  55.  
  56.     public String getChassis() {
  57.         return chassis;
  58.     }
  59.  
  60.     public String getYear() {
  61.         return year;
  62.     }
  63.  
  64.     public int getNumWheels() {
  65.         return numWheels;
  66.     }
  67.  
  68.     public int getHorsePower() {
  69.         return horsePower;
  70.     }
  71.  
  72.     public int getTorque() {
  73.         return torque;
  74.     }
  75.  
  76.     public int getMaxSpeed() {
  77.         return maxSpeed;
  78.     }
  79.  
  80.     public int getMaxRpm() {
  81.         return maxRpm;
  82.     }
  83.  
  84.     public double getKmDriven() {
  85.         return kmDriven;
  86.     }
  87. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement