Ledger Nano X - The secure hardware wallet
SHARE
TWEET

Distance

SUni2020 Mar 28th, 2020 70 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import java.util.Scanner;
  2.  
  3. public class Distance
  4. {
  5.     public static void main(String[] args)
  6.     {
  7.     Scanner scanner = new Scanner(System.in);
  8.  
  9.  
  10.         int firstSpeed = Integer.parseInt(scanner.nextLine());
  11.         int firstTime = Integer.parseInt(scanner.nextLine());
  12.         int secondTime = Integer.parseInt(scanner.nextLine());
  13.         int thirdTime = Integer.parseInt(scanner.nextLine());
  14.  
  15.  
  16.  
  17.         double firstDistans = firstSpeed * (firstTime / 60.0);
  18.         double secondDistans = (firstSpeed * 1.10)*(secondTime/60.0);
  19.         double thirdDistans = (firstSpeed * 1.1 * 0.95) * (thirdTime/60.0);
  20.         double allDistans = firstDistans + secondDistans + thirdDistans;
  21.  
  22.  
  23.  
  24.         System.out.println(String.format("%.2f", allDistans));
  25.  
  26.  
  27.     }
  28. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top