0

An office furniture company sells furniture in three colors: red, black and green. Every item in their inventory system has a 5-character code. The last two characters are always used to represent color. If an item is red, the last two characters are “41”. If an item is black, the last two characters are “25”. If an item is green, the last two characters are “30”. Ask the user to enter a 5-character code. Use the last 2 characters to determine the color. Display the color in the console window (“Red”, “Black” or “Green”). If the inventory code is not exactly 5 characters long, or if the last two characters are neither “41”, “25” nor “30”, display an error message (“Invalid inventory code”). [Hint: Use the substr function to extract the last two characters of the string and see whether the extracted substring is “41”, “25” or “30”).

3
Contributors
2
Replies
3
Views
5 Years
Discussion Span
Last Post by WaltP
0

post your code so we can attempt to clean and or fix one.

No, post your code so we can help you fix it. We don't clean and fix here -- the OP learns nothing if it's done for him.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.