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