Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Scholarship {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- int speed = Integer.parseInt(scanner.nextLine());
- int firstTime = Integer.parseInt(scanner.nextLine());
- int secondTime = Integer.parseInt(scanner.nextLine());
- int thirdTime = Integer.parseInt(scanner.nextLine());
- double firstTimeInHours = firstTime / 60.0;
- double secondTimeInHours = secondTime / 60.0;
- double thirdTimeInHours = thirdTime / 60.0;
- double distanceWithFirstSpeed = speed * firstTimeInHours;
- double speedAfterAcceleration = speed + (0.10 * speed);
- double distanceAfterAcceleationWithSecondTime = speedAfterAcceleration * secondTimeInHours;
- double speedAfterSlowDown = speedAfterAcceleration - (0.05 * speedAfterAcceleration);
- double distanceAfterSlowDownWithThirdTime = speedAfterSlowDown * thirdTimeInHours;
- double total = distanceWithFirstSpeed
- + distanceAfterAcceleationWithSecondTime
- + distanceAfterSlowDownWithThirdTime;
- System.out.printf("%.2f", total);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement