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 km = Integer.parseInt(sc.nextLine());
- String tarifa = sc.nextLine();
- double taxi =0;
- double price =0;
- if (tarifa.equals("day")){
- taxi = 0.79;
- } else taxi = 0.90;
- if (km < 20) {
- price = 0.70+(km * taxi);
- } else if (km<100){
- price = km*0.09;
- } else {
- price = km*0.06;
- }
- System.out.printf("%.2f", price);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment