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