Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class WorldSwimmingRecord {
- public static void main(String[] args) {
- Scanner scanner= new Scanner(System.in);
- double record= Double.parseDouble(scanner.nextLine());
- double distance= Double.parseDouble(scanner.nextLine());
- double timeForMeter= Double.parseDouble(scanner.nextLine());
- double time= distance*timeForMeter;
- double delay= Math.floor(distance/15);
- double totalDelay= delay*12.5;
- double totalTime= time+totalDelay;
- if(totalTime<record){
- System.out.printf("Yes, he succeeded! The new world record is %.2f seconds.", totalTime);
- }else{
- System.out.printf("No, he failed! He was %.2f seconds slower.",totalTime-record);
- }
- }
- }
Add Comment
Please, Sign In to add comment