Advertisement
TsetsoP

Transport

Dec 10th, 2019
201
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.50 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Transport {
  4.  
  5.     public static void main(String[] args) {
  6.         Scanner scan = new Scanner(System.in);
  7.         String time = scan.nextLine();
  8.         int n = scan.nextInt();
  9.         double price = 0;
  10.  
  11.         if (n >= 100) {
  12.             price = n + n * 0.06;
  13.         } else if (n <= 20 && n<=100) {
  14.             price = n + n*0.09;
  15.         }else if (time.equals ("day")) {
  16.             price = n + n*0.79;        
  17.         }else if (time.equals ("night")) {
  18.             price = n + n*0.90;        
  19.         }
  20. System.out.println("price= " + price);
  21.     }
  22.  
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement