bobby_k

Untitled

Mar 29th, 2018
508
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.86 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. /**
  4.  * Created by Stani on 29.3.2018 г..
  5.  */
  6. public class WorldRegordSwiming {
  7.     public static void main(String[] args) {
  8.         Scanner scanner = new Scanner(System.in);
  9.  
  10.         double seconds = Double.parseDouble(scanner.nextLine());
  11.         double distanceInMetres = Double.parseDouble(scanner.nextLine());
  12.         double timeInSeconds = Double.parseDouble(scanner.nextLine());
  13.  
  14.         double allSeconds = distanceInMetres * timeInSeconds;
  15.         double resistance = Math.floor(distanceInMetres / 15) * 12.5;
  16.         double allTime = allSeconds + resistance;
  17.         if ( seconds > allTime ){
  18.             System.out.printf("Yes, he succeeded! The new world record is %.2f seconds.",allTime);
  19.         }else {
  20.             System.out.printf("No, he failed! He was %.2f seconds slower.",allTime - seconds );
  21.         }
  22.     }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment