Question: 4. (A) Write a method that accepts a train code of type character (lower or upper case) and returns the corre- sponding train type according

4. (A) Write a method that accepts a train code of type character (lower or upper case) and returns the corre- sponding train type according to the following table: Train Code Train Type S or s Steam D or d Diesel W E or e Electric Others Invalid (B) Write a program that prompts the user to enter 10 train codes (char) and displays their corresponding train types by using the method defined in (A). The input/outout of the program should be displayed as follows: Enter 10 train codes: S This code represents Steam Train Type M This code represents Invalid Train Type d This code represents Diesel Train Type
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
