borkins

Exam 06-Mar-2016 - 02. Transport Price

May 14th, 2017
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.68 KB | None | 0 0
  1. /**
  2.  * Project: Exam_06_March_2016 - created by borkins on 2017-05-14.
  3.  */
  4.  
  5. import java.util.Scanner;
  6.  
  7. public class _02_TransportPrice
  8. {
  9.     public static void main(String[] args)
  10.     {
  11.         Scanner console = new Scanner(System.in);
  12.    
  13.         int n = Integer.parseInt(console.nextLine());
  14.         boolean isDay = (console.nextLine().toLowerCase().equals("day"));
  15.    
  16.         double price;
  17.    
  18.         if (n < 20)
  19.         {
  20.             if (isDay) price = n * 0.79f + 0.70f;
  21.             else price = n * 0.90f + 0.70f;
  22.         }
  23.         else if (n < 100) price = n * 0.09f;
  24.         else price = n * 0.06f;
  25.    
  26.         System.out.printf("%.02f%n", price);
  27.     }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment