package vehicles;

 

public class Car {

    private String registrationNumber;

    private String make;

    private String model;

    private int engineSize;

    private short yearFirstRegistered;

     

    public Car(String initialRegistrationNumber,

               String initialMake, String initialModel,

               int initialEngineSize,

               short initialYearFirstRegistered) {

        registrationNumber = initialRegistrationNumber;

        make = initialMake;

        model = initialModel;

        engineSize = initialEngineSize;

        yearFirstRegistered = initialYearFirstRegistered;

    }

     

    public void changeRegistrationNumber(String registrationNumber) {

        this.registrationNumber = registrationNumber;

    }

     

    public String getDescriptionOfCar() {

        return registrationNumber + " (" +

             yearFirstRegistered + "-" + make + ")";

    }

}

 

 

 

 

package vehicles;

public class Main {

    public static void main(String[] args) {

        Car car1 = new Car("HGS928", "Ford", "Focus", 1800, (short) 2010);

        System.out.println(car1.getDescriptionOfCar());

        car1.changeRegistrationNumber("ZZZ999");

        System.out.println(car1.getDescriptionOfCar());

 

    }

}

 

 

 

 

public static void main(String[] args) {

    Car car1 = new Car("HGS928", "Ford",

        "Focus", 1800, (short) 2010);

    System.out.println(car1.getDescriptionOfCar());

    car1.changeRegistrationNumber("ZZZ999");

    System.out.println(car1.getDescriptionOfCar());

    Car car2 = new Car("GGG666", "Mazda",

        "CX5", 2000, (short) 2013);

    Car car3 = new Car("JKL333", "Toyota",

        "Corolla", 1800, (short) 2012);

    System.out.println(car2.getDescriptionOfCar());

    System.out.println(car3.getDescriptionOfCar());        

}

 

 

 

 

 

package counting;

 

public class Main {

 

    public static void main(String[] args) {

        Counter c = new Counter();

        System.out.println(c.getNextValue());

        c.count = 0;

        System.out.println(c.getNextValue());

    }

}