Advertisement
SUni2020

Distance

Mar 28th, 2020
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Distance
  4. {
  5. public static void main(String[] args)
  6. {
  7. Scanner scanner = new Scanner(System.in);
  8.  
  9.  
  10. int firstSpeed = Integer.parseInt(scanner.nextLine());
  11. int firstTime = Integer.parseInt(scanner.nextLine());
  12. int secondTime = Integer.parseInt(scanner.nextLine());
  13. int thirdTime = Integer.parseInt(scanner.nextLine());
  14.  
  15.  
  16.  
  17. double firstDistans = firstSpeed * (firstTime / 60.0);
  18. double secondDistans = (firstSpeed * 1.10)*(secondTime/60.0);
  19. double thirdDistans = (firstSpeed * 1.1 * 0.95) * (thirdTime/60.0);
  20. double allDistans = firstDistans + secondDistans + thirdDistans;
  21.  
  22.  
  23.  
  24. System.out.println(String.format("%.2f", allDistans));
  25.  
  26.  
  27. }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement