#1, Im tryin to get this bb code right, #2 I need help with finding the problem with me code, it is saying that my for loop is a illegal start type and also a identifer is needed, but I have no clue, this is my first time doing object oriented programming, help please.
import javax.swing.JOptionPane;
public class Cars{
public static void main(String [] args){
carinfo honda = new carinfo();
carinfo bmw = new carinfo();
carinfo lexus = new carinfo();
carinfo chevy = new carinfo();
int honda;
hondat = hondat + honda.price;
}
private class carinfo{
String model;
int year =0;
int numberofdoors = 0;
int horsepower = 0;
int cost =0;
for(int i = 0; i <= 5; i++){
String Model = JOptionPane.showInputDialog("Enter car model");
honda.model = String.parseString(Model);
String Years = JOptionPane.showInputDialog("Enter car year");
honda.year = Integer.parseInt(Years);
String Numberofdoors = JOptionPane.showInputDialog("Enter amount of doors");
honda.numberofdoors = Integer.parseInt(Numberofdoors);
String Horsepower = JOptionPane.showInputDialog("Enter car horsepower");
honda.horsepower = Integer.parseInt(Horsepower);
String Cost = JOptionPane.showInputDialog("Enter car price");
honda.cost = Integer.parseInt(Cost);
}
for(int i=0; i < 5; i++){
lexus.model = JOptionPane.showInputDialog("Enter car model");
String Yearss = JOptionPane.showInputDialog("Enter car year");
lexus.year = Integer.parseInt(Yearss);
String Numberofdoorss = JOptionPane.showInputDialog("Enter amount of doors");
lexus.numberofdoors = Integer.parseInt(Numberofdoorss);
String Horsepowerss = JOptionPane.showInputDialog("Enter car horsepower");
lexus.horsepower = Integer.parseInt(Horsepowerss);
String Costss = JOptionPane.showInputDialog("Enter car price");
lexus.cost = Integer.parseInt(Costss);
}
for(int i=0; i < 5; i++){
chevy.model = JOptionPane.showInputDialog("Enter car model");
String Yearsss = JOptionPane.showInputDialog("Enter car year");
chevy.year = Integer.parseInt(Yearsss);
String Numberofdoorsss = JOptionPane.showInputDialog("Enter amount of doors");
chevy.numberofdoors = Integer.parseInt(Numberofdoorsss);
String Horsepowersss = JOptionPane.showInputDialog("Enter car horsepower");
chevy.horsepower = Integer.parseInt(Horsepowersss);
String Costsss = JOptionPane.showInputDialog("Enter car price");
chevy.cost = Integer.parseInt(Costsss);
}
for(int i=0; i < 5; i++){
bmw.model = JOptionPane.showInputDialog("Enter car model");
String Yearssss = JOptionPane.showInputDialog("Enter car year");
bmw.year = Integer.parseInt(Yearssss);
String Numberofdoorssss = JOptionPane.showInputDialog("Enter amount of doors");
bmw.numberofdoors = Integer.parseInt(Numberofdoorssss);
String Horsepowerssss = JOptionPane.showInputDialog("Enter car horsepower");
bmw.horsepower = Integer.parseInt(Horsepowerssss);
String Costssss = JOptionPane.showInputDialog("Enter car price");
bmw.cost = Integer.parseInt(Costssss);
}
}
}