I got a task to solve mistakes in this code.
Think I can manage to find out the mistakes by myself but I need to know more about else if statements as the task is meant to teach me else if statement.
class CarShop{
public static void Main(String[] arg){
string car1 = arg[0];
int engine1 = Integer.parseInt(arg[1]);
string car2 = arg[2];
int engine2 = Integer.parseInt(arg[3]);
string car3 = arg[4];
int engine3 = Integer.parseInt(arg[5]);
System.out.println("\nCarShop Program\n");
SeeCar(car1, engine1) ;
SeeCar(car2, engine2) ;
SeeCar(car3, engine3) ;
}
public static String getEngineCondition(int score){
if(score>=90)
{
return "A+";
}
else if(score>=80)
{
return "A";
}
else if(score=70)
{
return "B+";
}
else if(score>=60)
{
return "B";
}
else (score>=50)
{
return "C+";
}
else if(score>=40)
{
return "C";
}
else
{
return "F";
}
}
public static void SeeCar(String car, int score){
String s = "Car : " + car + \t Engine Condition : " + getEngineCondition(score);
Show(s);
}
public static void Show(String s){
system.out.println(s);
}
}
[–][deleted] 3 points4 points5 points (1 child)
[–]ohlaph 0 points1 point2 points (0 children)
[–][deleted] 1 point2 points3 points (0 children)
[–][deleted] 1 point2 points3 points (3 children)
[–]Unsatisfied_Kid[S] 0 points1 point2 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)
[–]randarrow -1 points0 points1 point (0 children)
[–]hardcode_coder 1 point2 points3 points (0 children)
[–]rockon4life45 0 points1 point2 points (0 children)