主题:这个机器人错在那了..
class Volcanorobot{
String status;
int speed;
float temperature;
void checkTemperature(){
if(temperature>600){
status="returning home";
speed=5;
}
}
void showAttributes(){
System.out.println("status: "+status);
System.out.println("speed: "+speed);
System.out.println("Temperature: "+temperature);
}
public static void main(string[] arguments){
Volcanorobot dante=new Volcanorobot();
dante.status="exploring";
dante.speed=2;
dante.temperature=510;
dante.showAttributes();
System.out.println("Increasing speed to 3.");
dante.speed=3;
dante.showAttributes();
System.out.println("Changing temperature to 670.");
dante.temperature=670;
dante.showAttributes();
System.out.println("Checking the temperature.");
dante.checkTemperature();
dante.showAttributes();
}
}
本人刚学JACA,这程序编了二天时间了,还是没通过。大家帮忙找找吧
String status;
int speed;
float temperature;
void checkTemperature(){
if(temperature>600){
status="returning home";
speed=5;
}
}
void showAttributes(){
System.out.println("status: "+status);
System.out.println("speed: "+speed);
System.out.println("Temperature: "+temperature);
}
public static void main(string[] arguments){
Volcanorobot dante=new Volcanorobot();
dante.status="exploring";
dante.speed=2;
dante.temperature=510;
dante.showAttributes();
System.out.println("Increasing speed to 3.");
dante.speed=3;
dante.showAttributes();
System.out.println("Changing temperature to 670.");
dante.temperature=670;
dante.showAttributes();
System.out.println("Checking the temperature.");
dante.checkTemperature();
dante.showAttributes();
}
}
本人刚学JACA,这程序编了二天时间了,还是没通过。大家帮忙找找吧