Advertisement
veronikaaa86

TransportPrice1111

Sep 28th, 2017
263
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.80 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class P21_TransportPrice {
  4.     public static void main(String[] args) {
  5.         Scanner scanner = new Scanner(System.in);
  6.  
  7.         int km = Integer.parseInt(scanner.nextLine());
  8.         String part = scanner.nextLine();
  9.  
  10.         double taxistart = 0.7;
  11.         double taxiday = 0.79;
  12.         double taxinight = 0.90;
  13.         double Bus = 0.09;
  14.         double Train = 0.06;
  15.  
  16.         if (km < 20 && part.equals("day")) {
  17.             System.out.println(taxistart + (km * taxiday));
  18.         } else if (km < 20 && part.equals("night")) {
  19.             System.out.println(taxistart + (km * taxinight));
  20.         } else if (km >= 20 && km < 100) {
  21.             System.out.println(km * Bus);
  22.         } else {
  23.             System.out.println(km * Train);
  24.         }
  25.     }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement