Advertisement
Guest User

Untitled

a guest
Feb 28th, 2017
238
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.65 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Ex01Distance {
  4.     public static void main(String[] args) {
  5.         Scanner scanner = new Scanner(System.in);
  6.         int startSpeed = Integer.parseInt(scanner.nextLine());
  7.         double time1 = Integer.parseInt(scanner.nextLine()) / 60.0;
  8.         double time2 = Integer.parseInt(scanner.nextLine()) / 60.0;
  9.         double time3 = Integer.parseInt(scanner.nextLine()) / 60.0;
  10.  
  11.         double totalTripDistance = startSpeed * time1;
  12.         totalTripDistance += startSpeed * 1.1 * time2;
  13.         totalTripDistance += startSpeed * 1.1 * 0.95 * time3;
  14.  
  15.         System.out.printf("%.2f%n", totalTripDistance);
  16.     }
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement