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