jwrbg

asd

Jan 29th, 2019
176
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.69 KB | None | 0 0
  1. package ProgammingBasics;
  2. import java.util.Scanner;
  3.  
  4. public class Steps {
  5.     public static void main(String[] args){
  6.         Scanner scanner = new Scanner(System.in);
  7.            int walkingSteps=0;
  8.  
  9.         while(true){
  10.             String Steps = scanner.nextLine();
  11.             if(Steps.equalsIgnoreCase("Going home")){
  12.                 System.out.printf("%d more steps to reach goal.",10000-walkingSteps);
  13.                 break;
  14.             }
  15.             walkingSteps=Integer.parseInt(Steps);
  16.             int sumSteps=10000-walkingSteps;
  17.             if(sumSteps<=0){
  18.                 System.out.println("Goal reached! Good job!");
  19.             }
  20.             }
  21.  
  22.  
  23.  
  24.            }
  25.     }
Advertisement
Add Comment
Please, Sign In to add comment