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 way = Double.parseDouble(scanner.nextLine());
- double time1m = Double.parseDouble(scanner.nextLine());
- double hasToSwim = way * time1m;
- double timeAdded = Math.floor(way / 15)* 12.5;
- double allTime = hasToSwim + timeAdded;
- double need = allTime - record;
- if (allTime >= record){
- System.out.printf("No, he failed! He was %.2f seconds slower.",need);
- }
- else if (record >= allTime){
- System.out.printf("Yes, he succeeded! The new world record is %.2f seconds.",Math.abs(allTime));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment