Assignment 7 in Computer Programming
Assignment 7 in Computer Programming
Instructions:
Design and develop a simple application program that displays an equivalent color once
an input letter matches its first character. Use logical OR and relational operator using switch
selection statement. Enhance your form design. Submit your form design and source code with
correct output.
Letters Colors
‘B’ or ‘b’ blue
‘Y’ or ‘y’ yellow
‘R’ or ‘r’ red
‘G’ or ‘g’ green
Other letters unknown color
If Else Statement:
Source Code:
textBox2.Text = "Blue";
textBox2.Text = "Yellow";
textBox2.Text = "Red";
textBox2.Text = "Green";
}
else
Switch Statement:
Source Code:
switch (textBox1)
textBox2.Text = "Blue";
break;
textBox2.Text = "Yellow";
break;
textBox2.Text = "Red";
break;
}
textBox2.Text = "green";
break;
default: