Question: Q2. Write a program that reports the contents of a compressed-gas cylinder based on the first letter of the cylinder's color. The program input is
Q2. Write a program that reports the contents of a compressed-gas cylinder based on the first letter of the cylinder's color. The program input is a character representing the observed color of the cylinder: "Y" or "Y" for yellow, "O" ar "o" for orange, and so on. Cylinder colors and associated contents are as follows: Orange ammonia Brown carbon monoxide Yellow hydrogen Green oxygen Your program should respond to input of a letter other than the first letters of the given colors with the message, Contents unknown. (Use switch case)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
