Discussion:
error message at compiled time <identifier>expected on line 4 &5.
(too old to reply)
a***@gmail.com
2014-11-07 15:43:43 UTC
Permalink
public class NestIFElevator {
public boolean openDoor = false;
public int currentFloor = 1;
public Final int TOP_FLOOR = 10;
public Final int MIN_FLOOR = 1;

public void doorOpen(){
System.out.println("Opening Door");
openDoor = true;
System.out.println("Door is Open");
}
public void closeDoor(){
System.out.println("Closing Door");
openDoor = false;
System.out.println("Door is Close");
}
public void goUp(){
System.out.println("Going up 1 floor");
currentFloor++;
System.out.println("Floor:" +currentFloor);
if(currentFloor == TOP_FLOOR){
System.out.println("Cannot go up");
}
else{
openDoor = true;
System.out.println("Door is Open");
}
public void goDown(){

if(currentFloor == MIN_FLOOR){
System.out.println("Cannot go down");
}
if(currentFloor > MIN_FLOOR){
if(!openDoor){
System.out.println("Going Down 1 Floor.");
currentFloor--;
System.out.println("Floor:"+currentFloor);
}
}

}
}
Eric Sosman
2014-11-07 15:50:38 UTC
Permalink
Post by a***@gmail.com
public class NestIFElevator {
public boolean openDoor = false;
public int currentFloor = 1;
public Final int TOP_FLOOR = 10;
public Final int MIN_FLOOR = 1;
`final' is not spelled `Final'.

(For future reference: If you have a question, ask a question.
The body of your message should contain at least one sentence that
ends with a question mark. Otherwise, everybody just has to guess
about what's puzzling you -- and we won't always guess correctly.)
--
***@comcast-dot-net.invalid
"Don't be afraid of work. Make work afraid of you." -- TLM
Loading...