Advertisement
veronikaaa86

02. Skeleton

Jun 18th, 2022
231
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.97 KB | None | 0 0
  1. package examPrep;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class P02Skeleton {
  6. public static void main(String[] args) {
  7. Scanner scanner = new Scanner(System.in);
  8.  
  9. int minRecord = Integer.parseInt(scanner.nextLine());
  10. int secRecord = Integer.parseInt(scanner.nextLine());
  11. double distance = Double.parseDouble(scanner.nextLine());
  12. int secondsPer100Meters = Integer.parseInt(scanner.nextLine());
  13.  
  14. int totalTimeInSeconds = (minRecord * 60) + secRecord;
  15. double additionalSecond = (distance / 120) * 2.5;
  16. double timeMarin = (distance / 100) * secondsPer100Meters - additionalSecond;
  17.  
  18. if (timeMarin <= totalTimeInSeconds) {
  19. System.out.println("Marin Bangiev won an Olympic quota!");
  20. System.out.printf("His time is %.3f.", timeMarin);
  21. } else {
  22. System.out.printf("No, Marin failed! He was %.3f second slower.", timeMarin - totalTimeInSeconds);
  23. }
  24. }
  25. }
  26.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement