MasterHimself

Untitled

Oct 12th, 2017
178
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. package javaapp;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class WorldRecord {
  6. public static void main(String[] args) {
  7. Scanner scanner = new Scanner(System.in);
  8.  
  9. double WorldRecord = Double.parseDouble(scanner.nextLine());
  10. double Distance = Double.parseDouble(scanner.nextLine());
  11. double Time = Double.parseDouble(scanner.nextLine());
  12.  
  13. double SmoothDive = Distance*Time;
  14. double Resistance=Math.floor(((Distance/15)*12.5));
  15. double TotalTime=SmoothDive+Resistance;
  16. double TimeLeft=TotalTime-WorldRecord;
  17.  
  18. if (TotalTime<WorldRecord) {
  19. System.out.printf(" Yes, he succeeded! The new world record is %.2f seconds.",TotalTime);
  20. } else if (TotalTime==WorldRecord) {
  21. System.out.printf("No, he failed! He was %.2f seconds slower.",TimeLeft);
  22. } else {
  23. System.out.printf("No, he failed! He was %.2f seconds slower.",TimeLeft);
  24. }
  25. }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment