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