I am fairly new at this and have been looking for a solution on Internet for two days, yet, I could not find any.
This is the class that I identified and initialized variables.
package HelloWorld;
import java.awt.*;
public class Car {
double averageMilesPerGallon;
String licensePlate;
Color paintColor;
boolean areTaillightsWorking;
public Car(double inputAverageMPG,
String inputLicensePlate,
Color inputPaintColor,
boolean inputAreTaillightsWorking) {
this.averageMilesPerGallon = inputAverageMPG;
this.licensePlate = inputLicensePlate;
this.paintColor = inputPaintColor;
this.areTaillightsWorking = inputAreTaillightsWorking;
}
}
Then, I wanted use these variables in my main class; however, it did not work. I received an error that was saying; "inputAverageMPG cannot be resolved to a variable" and "inputLicensePlate cannot be resolved to a variable." Please refer below to see the main class wherein I received the error.
package HelloWorld;
public class Main {
public static void main(String[] args) {
System.out.println("yes");
Car myCar = new Car(inputAverageMPG = 25.5, inputLicensePlate "12HTHF");
}
}