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