Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package examPreparation;
- import java.util.Scanner;
- public class P02MountainRun {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- double worldRecord = Double.parseDouble(scanner.nextLine());
- double distanceInM = Double.parseDouble(scanner.nextLine());
- double timeInSecForOneM = Double.parseDouble(scanner.nextLine());
- double georgiTime = distanceInM * timeInSecForOneM;
- double delay = Math.floor(distanceInM / 50) * 30;
- double allGeorgiTime = georgiTime + delay;
- if (allGeorgiTime < worldRecord) {
- System.out.printf("Yes! The new record is %.2f seconds.", allGeorgiTime);
- } else {
- System.out.printf("No! He was %.2f seconds slower.", allGeorgiTime - worldRecord);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement