Advertisement
Kancho

Journey

Feb 18th, 2019
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Even_Odd_Sum {
  4. public static void main(String[] args) {
  5. Scanner key = new Scanner(System.in);
  6.  
  7. String destination ="";
  8.  
  9. while (!"end".equals(destination)) {
  10. System.out.print("Enter destination: ");
  11. destination = key.nextLine();
  12.  
  13. System.out.print("Enter budget: ");
  14. int budget = Integer.parseInt(key.nextLine());
  15. int money = 0;
  16. while (money < budget) {
  17. System.out.print("Enter sum of savings: ");
  18. int saving = Integer.parseInt(key.nextLine());
  19. money += saving;
  20. System.out.printf("You have already saved %d%n",money);
  21. }
  22.  
  23. System.out.printf("You have the necessary %d! Go to %s!%n",budget, destination);
  24. System.out.println("Enter destination");
  25. destination = key.nextLine();
  26. }
  27.  
  28. }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement