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