Question: Using a chained if construct, compute the fare based on the age according to these conditions: If age is less than 12, then fare=3. If
Using a chained if construct, compute the fare based on the age according to these conditions: If age is less than 12, then fare=3. If the age is 12 to 65, then fare = 5. For all other positive ages, then fare=3$. - Else [out of range]
Input Format
Age: N
Constraints
1 <= N
Output Format
fare value
Sample Input 0
2
Sample Output 0
fare=3$
Sample Input 1
45
Sample Output 1
fare=5$
how is this in java ?
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
