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