Advertisement
Guest User

Untitled

a guest
May 26th, 2022
175
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.69 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class TransportPrice {
  4.      public static void main(String[] args) {
  5.         Scanner scanner = new Scanner(System.in);
  6.  
  7.         int n = Integer.parseInt(scanner.nextLine());
  8.         String timeOfDay = scanner.nextLine();
  9.         double price = 0;
  10.         String transport = "";
  11.  
  12.  
  13.         if (timeOfDay.equals("day") && n < 20) {
  14.             price = (n *  0.79) +  0.70;
  15.         }
  16.         else if (n < 20) {
  17.             price = (n * 0.90) + 0.70;
  18.         }
  19.         else if (n >= 100) {
  20.             price = (n * 0.06);
  21.         }
  22.         else if (n >= 20) {
  23.             price = n * 0.09;
  24.         }
  25.         System.out.printf("%.2f", price);
  26.     }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement