Advertisement
Guest User

Untitled

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