06. World Swimming Record
Къде греша ?
import java.util.Scanner;
public class WorldSwimmingRecord {
public static void main(String arg[]){
Scanner scanner = new Scanner(System.in);
double recordSec = Double.parseDouble(scanner.nextLine());
double distanceMetres = Double.parseDouble(scanner.nextLine());
double timeFor1Metre = Double.parseDouble(scanner.nextLine());
double record = distanceMetres * timeFor1Metre;
double resistance = (record / 15) * 12.5;
resistance = Math.floor(resistance);
double recordFinal = record + resistance;
if (recordSec > recordFinal) {
System.out.printf("Yes, he succeeded! The new world record is %.2f seconds.", recordFinal);
}
else if (recordSec <= recordFinal) {
double secNeeded = recordFinal - recordSec;
System.out.printf("No, he failed! He was %.2f seconds slower.", secNeeded);
}
}
}