A) Write a function that accepts a train code of type character (lower or uppercase) and returns the corresponding train type according to the following table:
B) Write a program that prompts the user to enter 12 train codes (char) and displays their corresponding train types by using the function defined in Part A. The Input/output of the program should be displayed as follows:
Train Code | Train Type |
S or s | Steam |
D or d | Diesel |
E or e | Electric |
Others | Invalid |
B) Write a program that prompts the user to enter 12 train codes (char) and displays their corresponding train types by using the function defined in Part A. The Input/output of the program should be displayed as follows:
|