SHARE
TWEET

Untitled

a guest Jan 21st, 2020 57 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import java.util.Scanner;
  2.  
  3. public class WorldSwimmingRecord {
  4.     public static void main(String[] args) {
  5.         Scanner scanner = new Scanner(System.in);
  6.  
  7.         double recordInSeconds = Double.parseDouble(scanner.nextLine());
  8.         double distanceInMeters = Double.parseDouble(scanner.nextLine());
  9.         double timeInSecondsPerMeter = Double.parseDouble(scanner.nextLine());
  10.  
  11.         double area = distanceInMeters * timeInSecondsPerMeter;
  12.         double waterPressure = distanceInMeters / 15;
  13.         double resultOfWaterPressure = waterPressure * 12.5;
  14.         Math.floor(resultOfWaterPressure);
  15.  
  16.         double allTime = area + resultOfWaterPressure;
  17.  
  18.         if (allTime < recordInSeconds) {
  19.             System.out.printf("No, he failed! He was %.2f seconds slower.", allTime);
  20.         } else {
  21.             System.out.printf("Yes, he succeeded! The new world record is %.2f seconds.", allTime);
  22.         }
  23.  
  24.     }
  25. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top