Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Car
- {
- private double price;
- private int brakeHorsePower;
- private String regPlate;
- private int numSeats;
- private String manufacturerName;
- private String model;
- private String name;
- private String colour;
- // constructor with params
- public Car(double p, int bHP, String rP, int nS, String mN, String m,
- String n, String c)
- {
- this.price = p;
- this.brakeHorsePower = bHP;
- this.regPlate = rP;
- this.numSeats = nS;
- this.manufacturerName = mN;
- this.model = m;
- this.name = n;
- this.colour = c;
- }
- // constructor without params
- public Car()
- {
- this.price = 3300.0;
- this.brakeHorsePower = 15;
- this.regPlate = "99-KY-DEFAULT";
- this.numSeats = 4;
- this.manufacturerName = "Ford";
- this.model = "Model T";
- this.name = "EXAMPLE_RANDOM_STRING_VIN_UUID";
- this.colour = "Ultra-Green";
- }
- public double getPrice()
- {
- return price;
- }
- public void setPrice(double price)
- {
- this.price = price;
- }
- public int getBrakeHorsePower()
- {
- return brakeHorsePower;
- }
- public void setBrakeHorsePower(int brakeHorsePower)
- {
- this.brakeHorsePower = brakeHorsePower;
- }
- public String getRegPlate()
- {
- return regPlate;
- }
- public void setRegPlate(String regPlate)
- {
- this.regPlate = regPlate;
- }
- public int getNumSeats()
- {
- return numSeats;
- }
- public void setNumSeats(int numSeats)
- {
- this.numSeats = numSeats;
- }
- public String getManufacturerName()
- {
- return manufacturerName;
- }
- public void setManufacturerName(String manufacturerName)
- {
- this.manufacturerName = manufacturerName;
- }
- public String getModel()
- {
- return model;
- }
- public void setModel(String model)
- {
- this.model = model;
- }
- public String getName()
- {
- return name;
- }
- public void setName(String name)
- {
- this.name = name;
- }
- public String getColour()
- {
- return colour;
- }
- public void setColour(String colour)
- {
- this.colour = colour;
- }
- public void printDetails()
- {
- System.out.println("******** Car: " + name + " ********");
- System.out.println("Manufacturer Name: " + manufacturerName
- + "\nModel: " + model + "\nPrice: " + price + "\nBHP: "
- + brakeHorsePower + "\nRegistration Plate: " + regPlate
- + "\nNumber of Seats: " + numSeats + "\nColour: " + colour);
- System.out.println("**********************************\n");
- }
- public void printPrice()
- {
- System.out.println("Price: " + price);
- }
- public void printBHP()
- {
- System.out.println("BHP: " + brakeHorsePower);
- }
- public void printRegPlate()
- {
- System.out.println("Registration Plate: " + regPlate);
- }
- public void printNumSeats()
- {
- System.out.println("Seats: " + numSeats);
- }
- public void printManufacturerName()
- {
- System.out.println("Manufacturer Name: " + manufacturerName);
- }
- public void printModel()
- {
- System.out.println("Model: " + model);
- }
- public void printName()
- {
- System.out.println("Name: " + name);
- }
- public void printColour()
- {
- System.out.println("Colour: " + colour);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment