Advertisement
MilaDimitrovaa

cena na transport

Nov 3rd, 2019
253
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.62 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class CenaNaTransport {
  4.  
  5.     public static void main(String[] args) {
  6.         Scanner scan = new Scanner(System.in);
  7.        
  8.         int distance = Integer.parseInt(scan.nextLine());
  9.         String DayorNight = scan.nextLine();
  10.         double price = 0;
  11.         double taxiRate = 0;
  12.        
  13.         if(DayorNight.equals("Day")) {
  14.             taxiRate = 0.79;
  15.         }else if(DayorNight.equals("Night")) {
  16.             taxiRate = 0.90;
  17.         }
  18.         if(distance < 20) {
  19.             price = 0.70 + (distance + taxiRate);
  20.         }else if (distance < 100) {
  21.             price = distance*0.09;
  22.         }else {
  23.             price = distance * 0.06;
  24.            
  25.         }
  26.         System.out.println(price);
  27.  
  28.     }
  29.  
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement