Numbers, types, input and output... you have been learning quickly. Not it's time for decision making. Hope you still remember what we played in Kahoot! but if not, take a look at the reference link below:
Now you try:
1. In many countries, the number 13 is considered unlucky. Rather than offending superstitious tenants, building owners sometimes skip the thirteenth floor; floor 12 is immediately followed by floor 14. Of course, floor 13 is not usually left empty. It is simply called floor 14. The computer that controls the building elevators needs to compensate for this foible and adjust all floor numbers above 13. Below is the code in Java, but some key statements are missing. Will you fix?
This program simulates an elevator panel that skips the 13th floor.
public class ElevatorSimulation
public static void main(String args)
Scanner in = new Scanner(System.in);
int floor = in.nextInt();
// Adjust floor if necessary
if () // What's missing here?
actualFloor = floor - 1;
actualFloor = floor;
System.out.println("The elevator will travel to the actual floor " + actualFloor);
2. What is the error in this statement?
if (scoreA = scoreB)
3. Supply a condition in this if statement to test whether the user entered a Y:
System.out.println("Enter Y to quit.");
String input = in.next();
if (. . .)
4. In a game program, the scores of players A and B are stored in variables scoreA
and scoreB. Assuming that the player with the larger score wins, write an if/
else if/else sequence that prints out "A won", "B won", or "Game tied".