Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- /**
- * Created by Stani on 29.3.2018 г..
- */
- public class WorldRegordSwiming {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- double seconds = Double.parseDouble(scanner.nextLine());
- double distanceInMetres = Double.parseDouble(scanner.nextLine());
- double timeInSeconds = Double.parseDouble(scanner.nextLine());
- double allSeconds = distanceInMetres * timeInSeconds;
- double resistance = Math.floor(distanceInMetres / 15) * 12.5;
- double allTime = allSeconds + resistance;
- if ( seconds > allTime ){
- System.out.printf("Yes, he succeeded! The new world record is %.2f seconds.",allTime);
- }else {
- System.out.printf("No, he failed! He was %.2f seconds slower.",allTime - seconds );
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment