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