ulvis.paste.net

Paste Search Dynamic
Word Swimming Record
  1. package simpleConditions;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class WordRecord {
  6.     public static void main(string[] args) {
  7.         Scanner scanner = new Scanner(system.in);
  8.         double worldRecordSec = double.parseDouble(scanner.nextLine());
  9.         double distanceM = double.parseDouble(scanner.nextLine());
  10.         double secPerM = double.parseDouble(scanner.nextLine());
  11.  
  12.         double distance = distanceM * secPerM;
  13.         double delay = math.floor(distanceM / 15) * 12.5;
  14.         double totalTime = distance + delay;
  15.  
  16.         //double diff = Math.abs(worldRecordSec - totalTime);
  17.         if (worldRecordSec <= totalTime) {
  18.             system.out.printf("No, he failed! " +
  19.                     "He was %.2f seconds slower.", totalTime - worldRecordSec);
  20.         } else {
  21.             system.out.printf("Yes, he succeeded! " +
  22.                     "The new world record is %.2f seconds.", totalTime);
  23.         }
  24.     }
  25. }
Parsed in 0.021 seconds