Easy Travels charges fare from the passengers based on the distance travelled as per the tariff given below:
Distance Travelled
Fare
Up to 3 km
₹11/km
Next 4 km
₹13/km
Next 5 km
₹15/km
Above12 km
₹18/km
Fixed charge of ₹30 is applied to all the bookings.
Write a program to input distance travelled by the passenger. Calculate and display the fare to be paid.in java
PLS ANSWER URGENTLY
Answers
Answered by
0
Answer:
Fixed charge is Rs.5 and the charge per kilometer is Rs.10 For 25 km person have to pay Rs.255.
Let fixed charge be Rs x and charge per km be Rs y.
⇒x+10y=105...(1)
⇒x+15y=155..(2).
Now From eq 2
⇒15y=155−x
⇒y=
15
155−x
...(3)
Substituting y from eq3 in eq1
⇒x+
15
10(155−x)
=105
⇒15x+1550−10x=1575
⇒5x=1575−1550
⇒5x=25
⇒x=5
Substituting x in eq2
⇒5+15y=155
⇒15y=155−5
⇒15y=150
Hence x=5 and y=10
Fixed charge is Rs.55 and the charge per kilometer is Rs.1010
For 2525 km person have to pay = 5+10×25=255Rs.
Similar questions