Advertisement
Guest User

Untitled

a guest
Jun 25th, 2019
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Ex15_travelling {
  4. public static void main(String[] args) {
  5. Scanner scan = new Scanner(System.in);
  6. String destination = scan.nextLine();
  7.  
  8. while (!destination.equals("End")){
  9. double budget = Integer.parseInt(scan.nextLine());
  10. double sum = 0;
  11. while (sum < budget){
  12. double money = Integer.parseInt(scan.nextLine());
  13. sum = sum + money;
  14. }
  15. System.out.printf("Going to %s!%n", destination);
  16. destination = scan.nextLine();
  17. }
  18. }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement