Advertisement
YavorGrancharov

TransportPrice

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