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