title: Car class program
body: <p>Below is the driver class I was given and I am not allowed to edit/change this class</p>
  
  <pre><code>public class HW2tester
  {
     public static void main(String[] args)
     {
        Car car1 = new Car();
        Car car2 = new Car("Ford", 2013, 20000);
        Car car3 = new Car("Audi", 2012, 25000);
        Car car4 = new Car();
  
    car2.setPrice(22000);
    car2.setYear(2011);
  
    car4.setBrand("Cadillac");
  
    System.out.println("This car is " + car1.getBrand() + ", year " + car1.getYear() + ", price " + car1.getPrice());
    System.out.println("This car is " + car2.getBrand() + ", year " + car2.getYear() + ", price " + car2.getPrice());
    System.out.println("This car is " + car3.getBrand() + ", year " + car3.getYear() + ", price " + car3.getPrice());
    System.out.println("This car is " + car4.getBrand() + ", year " + car4.getYear() + ", price " + car4.getPrice());
  
    System.out.println("The total car number is: " + car1.getNumber());
    System.out.println("The total car number is: " + car2.getNumber());
    System.out.println("The total car number is: " + car3.getNumber());
    System.out.println("The total car number is: " + car4.getNumber());
     }
  }
  </code></pre>
  
  <p>This is the Car.java class file I created</p>
  
  <pre><code>public class Car
  {
     private int year;
     private String brand;
     private int price;
     private int number;
  
  public Car()
  {
     year = 0;
     brand = null;
     price = 0;
     number = 0;
  }
  
  public Car( int y, String b, int p)
  {
     number++;
     year = y;
     brand = b;
     price = p;
  }
  
  public void setYear( int y)
  {
     year = y;
  }
  
  public void setBrand( String b)
  {
     brand = b; 
  }
  
  public void setPrice( int p)
  {
     price = p;
  }
  
  public int getYear()
  {
     return year;
  }
  
  public String getBrand()
  {
     return brand;
  }
  
  public int getPrice()
  {
     return price;
  }
  
  public int getNumber()
  {
     return number;
  }
  
  }   
  </code></pre>
  
  <p>Problems I am having:
  Trying to incorporate count to display total numbers of cars (4)
  First car object car1 and last car4 are not displaying due to driver class being blank and I cannot change the tester class, only my car class.  </p>
  
  <p>what output is supposed to look like</p>
  
  <pre><code>This car is Chevy, year 2005, price 3000
  This car is Ford, year 2011,price 22000
  This car is Audi, year 2012, price 25000
  This car is Cadillac, year 2005, price 3000
  The total car number is: 4
  The total car number is: 4
  The total car number is: 4
  The total car number is: 4
  </code></pre>
  
  <p><strong><em>EDIT</em></strong> 
  Ive made the changes recommended to me but I am getting an error message about String to Int conversion for some reason. Here are the changes I have made and the error message I am getting. </p>
  
  <pre><code>public class Car
  {
     int year;
     String brand;
     int price;
     static int number;
  
  public Car()
  {
     year = 2005;
     brand = "Chevy";
     price = 3000;
     number++;
  }
  
  HW2tester.java:6: error: incompatible types: String cannot be converted to int
        Car car2 = new Car("Ford", 2013, 20000);
                           ^
  HW2tester.java:7: error: incompatible types: String cannot be converted to int
        Car car3 = new Car("Audi", 2012, 25000);
                       ^
  </code></pre>