Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Transport {
- public static void main(String[] args) {
- Scanner sc = new Scanner(System.in);
- int n = Integer.parseInt(sc.nextLine());
- String time = sc.nextLine();
- double price = 0;
- if (n < 20 && time.equals("day")) {
- price = 0.70 + n * 0.79;
- } else if (n < 20 && time.equals("night")) {
- price = 0.70 + n * 0.90;
- }
- if (n >= 20 && n < 100) {
- price = n * 0.09;
- }
- if (n >= 100) {
- price = n * 0.06;
- }
- System.out.println(price);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement