Advertisement
KechevD

KursovaRabota_Transport

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