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 scan = new Scanner(System.in);
- int n = Integer.parseInt(scan.nextLine());
- String dayOrNigth = scan.nextLine();
- double taxi = 0;
- double bus = 0;
- double train= 0;
- if ("day".equals(dayOrNigth)){
- taxi=(0.79*n)+0.70;
- }else if ("night".equals(dayOrNigth)){
- taxi= (0.90*n)+0.70;
- }else if (n<=20){
- bus=n*0.09;
- }else if (n<100 & n>20){
- train=n*0.06;
- }
- System.out.printf("Taxi:"+"%.02f",taxi,"Bus:"+ bus,"Train:"+train);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment