Download as pdf or txt
Download as pdf or txt
You are on page 1of 10

Programming Language 1

using
Visual C# Visual C#
Machine Problems 03 to 08
Prepared by: Mr. Dan Chua for SISC
Machine Problem #03
Instructions: (The Use of if...else Statements)
1. Write a C# program to accept character in (R,B,Y,G,M) only
2. If R is entered, display RED in text color Red
B, display BLUE in text color Blue
Y, display YELLOW in text color Yellow
G, display GREEN in text color Green
M, display MAGENTA in text color Magenta
3. Continue running the program until the user decides to terminate it.
4. Sample display is given below: 4. Sample display is given below:
Machine Problem #04
Instructions: (Using if...else Statements)
1. Write a C# program to accept 3 integer numbers
2. Determine the highest and lowest numbers
3. Using Math Class, get the Square Root of the highest and lowest
4. Follow sample output as shown below
(take note of the formatting of output)
Machine Problem #05- Part A
Convert this flowchart into C# program.
Display numbers in ASCENDING ORDER (lowest to highest)
Note: Use Nested IfElse Statements when coding your C#.
Machine Problem #05-Part B
Input 4 numbers,
Create a C# program that will display the 4 numbers in
DESCENDING Order using IF...ELSE statements DESCENDING Order using IF...ELSE statements
(Highest to Smallest)
Machine Problem #06
Create a C# program to display remarks of the corresponding
grade:
70 74 - Failed
75 80 - Passed
81 85 - Good
86 89 - Very Good 86 89 - Very Good
90 95 - Superior
96 100 - Excellent
Note: Use If...Else or Switch Selection Statement
AnimalName Attribute Years
Horse Hardworking, Independent and Intelligent. 1882, 1894, 1906, 1918, 1930, 1942
Goat Elegant, artistic and good-natured. 1883, 1895, 1907, 1919, 1931, 1943
Monkey Clever but mischievous and Successful. 1884, 1896, 1908, 1920, 1932, 1944
Rooster Hardworking, strong-willed and confident. 1885, 1897, 1909, 1921, 1933, 1945
Machine Problem #07
Create C# program to
1. Accept year (i.e. 1950, 1995)
2. Display the Animal year and its description or attribute
3. Continue running the program until user terminates
Rooster Hardworking, strong-willed and confident. 1885, 1897, 1909, 1921, 1933, 1945
Dog Faithful, Honest and Friendly. 1886, 1898, 1910, 1922, 1934, 1946
Pig Honest, Peace-loving and can be Untidy. 1887, 1899, 1911, 1923, 1935, 1947
Rat Ambitious, Hard-working and Imaginative. 1888, 1900, 1912, 1924, 1936, 1948
Ox Leader, Dependable, Patient and Loyal. 1889, 1901, 1913, 1925, 1937, 1949
Tiger Sensitive, Emotional and Adventurous. 1890, 1902, 1914, 1926, 1938, 1950
Rabbit Affectionate, Gentle and Caring. 1891, 1903, 1915, 1927, 1939, 1951
Dragon Confident, Hardworking and Energetic. 1892,1904, 1916, 1928, 1940, 1952
Snake Charming, Good thinkers and Patient. 1983,1905, 1917, 1929 1941, 1953
Machine Problem #08
Create a C# program (use Switch) with the following specifications:
1. Declare a variable with data type (char).
2. Accept value (no numeric value)
3. Convert it to its equivalent numeric value
(you may refer to your phone for reference)
#, @, % = 1 J, j, K, k, L, l = 5 W, w, X, x, Y, y, Z, z = 9
A, a, B, b, C, c = 2 M, m, N, n, O, o = 6 +, >, < = 0
D, d, E, e, F, f = 3 P, p, Q, q, R, r, S, s = 7
G, g, H, h, I, i = 4 T, t, U, u, V, v = 8
4. Follow sample output as shown below: 4. Follow sample output as shown below:
Note in submitting your Machine Problems (MPs)
General Instruction:
As soon as you finish each of your MP, upload a copy to Moodle in
the following format:
-- <your name>
-- <MP #>
-- <copy of the entire codes>
Your grades will be based on the following:
1. Arts & Style of programming
(the use of variables/data types and proper indentation)
2. Uniqueness of your codes (strictly no copying of codes)
3. Strictly following program specifications
4. Correct output
Specific Instructions:
Your instructor will give you the details of the program specifications and deadlines
during the class.
End of Lesson 07
Machine Problems
Prepared by: Mr. Dan Chua for SISC

You might also like