this is the prompt for the question:
The Car class contains four class attributes, make, year, serialNumber, and color. We sometimes want to create a new Car object with the same make, year and color but with a different serial number, as another car.
For example, if myCar is a red, 1999 VW, with serial number 4444, then this statement:
myCar.create(2345);
will create a new red 1999 VW with serial number 2345.
Write the create method, which takes an int value -- the new serial number -- as an input parameter, and then creates a new Car object with the same make, year, and color values as the Car object being called, but with the new serial number. The method should return the newly created Car object.
then the code given
public class Car { public static final String FORD = "Ford"; public static final String GM = "GM"; public static final String SAAB = "Saab"; public static final String TOYOTA = "Toyota"; public static final String VW = "Volkswagen"; public static final String RED = "red"; public static final String BLUE = "blue"; public static final String WHITE = "white"; private String make; private int year; private int serialNumber; private String color; public Car(String mk, int yr, int serial, String cl) { make = mk; year = yr; serialNumber = serial; color = cl; } public Car create(int serial) { MY CODE GOES HERE } // end method } // end class
I inputed:
where MY CODE GOES HEREreturn new Car(make, year, serialNumber, color);
help? haha