Advertisement
finderabc

worldRecord

Oct 25th, 2018
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.74 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class worldRecord {
  4.     public static void main(String[] args) {
  5.         Scanner scan = new Scanner(System.in);
  6.  
  7.         double record = Double.parseDouble(scan.nextLine());
  8.         double lenght = Double.parseDouble(scan.nextLine());
  9.         double timeFor = Double.parseDouble(scan.nextLine());
  10.  
  11.         double totalTime = lenght * timeFor;
  12.         double delay = Math.floor(lenght / 15) * 12.5;
  13.         double total = totalTime + delay;
  14.  
  15.         if (record < total) {
  16.             System.out.printf("No, he failed! He was %.2f seconds slower.", (total - record));
  17.         } else {
  18.             System.out.printf("Yes, he succeeded! The new world record is %.2f seconds.", total);
  19.         }
  20.     }
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement