Question: 1. Write a Java program to take the input for number of miles, and the class of journey (1,2, or 3, for first, second, and

1. Write a Java program to take the input for number of miles, and the class of journey (1,2, or 3, for first, second, and third class respectively), for a train journey. The program should then calculate and display the fare of journey based on the following criteria: First (1) Class Second (1) Class Third (3) Class First 100 mile $3 per mile $2 per mile Next 150 mile $ 2.50 per mile $ 1.50 per mile Remaining $2 per mile $1 per mile $1.50 per mile $1 per mile $0.50 per mile
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
