ventsislav83

TransportPrice

May 16th, 2017
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.71 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class TransportPrice {
  4.  
  5.     public static void main(String[] args) {
  6.  
  7.         Scanner scan = new Scanner(System.in);
  8.  
  9.         int n = Integer.parseInt(scan.nextLine());
  10.         String dayOrNigth = scan.nextLine();
  11.         double taxi = 0;
  12.         double bus = 0;
  13.         double train= 0;
  14.  
  15.  
  16.         if ("day".equals(dayOrNigth)){
  17.             taxi=(0.79*n)+0.70;
  18.  
  19.         }else if ("night".equals(dayOrNigth)){
  20.             taxi= (0.90*n)+0.70;
  21.         }else if (n<=20){
  22.             bus=n*0.09;
  23.         }else if (n<100 & n>20){
  24.             train=n*0.06;
  25.  
  26.         }
  27.  
  28.         System.out.printf("Taxi:"+"%.02f",taxi,"Bus:"+ bus,"Train:"+train);
  29.  
  30.  
  31.  
  32.         }
  33.     }
Advertisement
Add Comment
Please, Sign In to add comment