A shop delivers things by bike or by truck. Write these classes.
Delivery is an abstract class. It has an abstract method int charge(int km) and a normal method String bill(int km) that returns Charge: followed by charge(km).Bike extends Delivery. Its charge is 5 * km.Truck extends Delivery. Its charge is 50 + 8 * km.The first line has the word bike or truck. The second line has the distance km (a whole number, 0 or more).
One line with the result of bill(km).
Input:
bike
10
Output:
Charge: 50

A shop delivers things by bike or by truck. Write these classes. - `Delivery` is an abstract class. It has an abstract method `int charge(int km)` and a normal method `String bill(int km)` that returns `Charge: ` followed by `charge(km)`. - `Bike` extends `Delivery`. Its charge is `5 * km`. - `Truck` extends `Delivery`. Its charge is `50 + 8 * km`. ### Input Format The first line has the word `bike` or `truck`. The second line has the distance `km` (a whole number, 0 or more). ### Output Format One line with the result of `bill(km)`. ### Example Input: ``` bike 10 ``` Output: ``` Charge: 50 ``` A canteen takes payment in three ways. Write an interface `Payment` with one method `int pay(int bill)`, and three classes that implement it. - `Cash` returns the bill as it is. - `Card` adds a fee of 2 percent: it returns `bill + bill / 50` (integer division). - `Upi` gives a cashback of 1 percent: it returns `bill - bill / 100` (integer division). ### Input Format The first line has `n`. Each of the next `n` lines has a mode (`cash`, `card` or `upi`) and a bill (a whole number, 0 or more). ### Output Format For each line, the amount to pay, one per line. ### Example Input: ``` 2 card 1000 upi 1000 ``` Output: ``` 1020 990 ``` Write an interface `Fare` with these methods. - `int perPerson()` has no body. - `default int total(int people)` returns `perPerson() * people`. Then write two classes that implement `Fare`. Both have a constructor that takes the distance `km`. - `BusFare`: `perPerson()` returns `2 * km`. - `TrainFare`: `perPerson()` returns `3 * km + 10`. Do not write `total` in the classes. They get it from the interface. ### Input Format One line with three values: the kind (`bus` or `train`), the distance `km` and the number of `people`. Both numbers are whole numbers, 0 or more. ### Output Format One line: `Total: ` and the total fare. ### Example Input: ``` bus 10 3 ``` Output: ``` Total: 60 ```