SHARE
TWEET

Exam 1-2 December 2018 MountainRun

yovkovbpfps Apr 24th, 2019 66 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import java.util.Scanner;
  2.  
  3. public class MountainRun {
  4.     public static void main(String[] args) {
  5.         Scanner scanner = new Scanner(System.in);
  6.  
  7.         double seconds = Double.parseDouble(scanner.nextLine());
  8.         double meters = Double.parseDouble(scanner.nextLine());
  9.         double timeInSecondsForOneMeter = Double.parseDouble(scanner.nextLine());
  10.  
  11.         double inclide = meters * timeInSecondsForOneMeter;
  12.         double inclide2 = Math.floor(meters / 50) * 30;
  13.         double timeNeeded = inclide + inclide2;
  14.  
  15.         double ostatuk = timeNeeded - seconds;
  16.  
  17.         if (seconds > timeNeeded){
  18.             System.out.printf("Yes! The new record is %.2f seconds.",timeNeeded);
  19.         }else{
  20.             System.out.printf("No! He was %.2f seconds slower.",ostatuk );
  21.         }
  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