Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Ex01Distance {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- int startSpeed = Integer.parseInt(scanner.nextLine());
- double time1 = Integer.parseInt(scanner.nextLine()) / 60.0;
- double time2 = Integer.parseInt(scanner.nextLine()) / 60.0;
- double time3 = Integer.parseInt(scanner.nextLine()) / 60.0;
- double totalTripDistance = startSpeed * time1;
- totalTripDistance += startSpeed * 1.1 * time2;
- totalTripDistance += startSpeed * 1.1 * 0.95 * time3;
- System.out.printf("%.2f%n", totalTripDistance);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement