Advertisement
Krassi_Daskalova

Travelling

Feb 22nd, 2019
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Vacation {
  4. public static void main(String[] args) {
  5. Scanner scanner = new Scanner(System.in);
  6.  
  7. String destination = scanner.nextLine();
  8.  
  9. while (!destination.equals("End")) {
  10. double price = Double.parseDouble(scanner.nextLine());
  11. double savings = 0;
  12.  
  13. while (savings < price){
  14. savings += Double.parseDouble(scanner.nextLine());
  15. }
  16. System.out.println("Going to " + destination + "!");
  17. destination = scanner.nextLine();
  18. }
  19. }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement