Answer to Question #277287 in Algorithms for MaryClaire

Question #277287

Write an algorithm that displays an equivalent color once an input letter matches its first character.


1
Expert's answer
2021-12-08T16:29:55-0500

Write a program that displays an equivalent color once an input letter match its first character.

For example, b for Blue, r for Red, and so on. Here are the given criteria:

Letters Colors

‘B’ or ‘b’ Blue

‘R’ or ‘r’ Red

‘G’ or ‘g’ Green

‘Y’ or ‘y’ Yellow

other letters “Unknown Color”


Algorithm:


Enter a letter(let)

if ((let==’B’) || (let==’b’))

print “Blue”

if ((let==’R’) || (let==’r’))

print “Red”

if ((let==’G’) || (let==’g’))

print “Green”

if ((let==’Y’) || (let==’y’))

print “Yellow”

Else

print ”Unknown Color”



Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS