Advertisement
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);
- double trip = scan.nextDouble();
- String time = scan.next();
- double price = 0;
- if (trip < 20){
- if (time.equals("day")){
- price += 0.7 + (0.79 * trip);
- }
- else{
- price += 0.7 + (0.9 * trip);
- }
- }
- if (trip < 100){
- price += 0.09 * trip;
- }
- else{
- price = 0.06 * trip;}
- System.out.printf("Your price is: %.2f", price);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement