Advertisement
atanasovetr

Transport

Jun 7th, 2020
1,009
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.66 KB | None | 0 0
  1. import java.util.Scanner;
  2. public class TransportPrice {
  3.     public static void main(String[] args) {
  4.         Scanner scan = new Scanner(System.in);
  5.         double trip = scan.nextDouble();
  6.         String time = scan.next();
  7.         double price = 0;
  8.  
  9.         if (trip < 20){
  10.             if (time.equals("day")){
  11.                 price += 0.7 + (0.79 * trip);
  12.             }
  13.             else{
  14.                 price += 0.7 + (0.9 * trip);
  15.             }
  16.         }
  17.         if (trip < 100){
  18.                 price += 0.09 * trip;
  19.         }
  20.         else{
  21.             price = 0.06 * trip;}
  22.         System.out.printf("Your price is: %.2f", price);
  23.  
  24.     }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement