Untitled
unknown
plain_text
3 years ago
782 B
6
Indexable
import java.util.Scanner;
public class Homework7 {
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 time = Double.parseDouble(scanner.nextLine());
double secondsSwimming = distance * time;
double resistance = Math.floor(distance / 15) * 12.5;
double total = secondsSwimming + resistance;
if (total < record) {
System.out.printf("Yes, he succeeded! The new world record is %.2f seconds.", total);
} else {
System.out.printf("No, he failed! He was %.2f seconds slower.", total - record);
}
}
}Editor is loading...