You are on page 1of 3

Republic of the Philippines

SURIGAO DEL NORTE STATE UNIVERSITY


Narciso Street, Surigao City 8400, Philippines
“For Nation’s
Greater Heights”

LEARNING MODULE NO. 5 – POSTTEST

Instructions: Answer the following questions as directed.

Pls pass the following:

a. Program Code
b. Screenshot of Sample Output

1. Develop a C++ program which will compute the area of a square (area = side* side or a
triangle (area = base ⁄ height)/2) after prompting the user to type the first character of the figure
name (t or s).

2. It is decided to base the fine for speeding in a built-up area as follows 500 pesos if speed is
between 31 and 40 mph, 750 pesos if the speed is between 41 and 50 mph and 1000 pesos if he
speed is above 50 mph. Develop a program to implement the task.

3. Develop a program that will assign a character grade to a percentage mark as follows - 70 or
over A, 60-69 B, 50-59 C, 40-49 D, 30-39 E, less than 30 F.

4. A student is given a grade from ‘A’ to ‘F’ in a test. So averages can be calculated it is required
to assign marks to these grades as follows, ‘A’ is 10, ‘B’ is 8, ‘C’ is 6, ‘D’ is 4, ‘E’ is 2 and ‘F’ is 0.
Develop a program that would implement this task.

5. 5. A student has a percentage mark for an examination; these marks are to be converted to
grades as follows:

>=70 ‘A’

60-69 ‘B’

50-59 ‘C’

40-49 ‘D’

30-39 ‘E’

<30 ‘ F’

Create a program that would implement this task.

Tel. Nos.: (086) 827-3741 Email: info@snsu.edu.ph


URL: snsu.edu.ph
Republic of the Philippines
SURIGAO DEL NORTE STATE UNIVERSITY
Narciso Street, Surigao City 8400, Philippines
“For Nation’s
Greater Heights”

6. Create a program that lets the user enter the insurance code and compute the medical
deduction. Below is the list of insurance codes and its corresponding value.

Insurance Code Medical Deduction

F 0

B 4.65

K 7.85

E 5.50

If the user inputs an invalid code, “Invalid Code” will be displayed on screen.

7. Create a program that asks the user to enter a character. If the character is ‘M’, display
“Male”. If the character if “F”, display “Female”.

8. Create a program that would let the user enter a transaction code and display the
corresponding text.

Transaction Code TEXT

D Deposit transaction

W Withdrawal transaction

T Transfer transaction

If the user inputs an invalid code, “Invalid Code” will be displayed on screen

9. Create a program that requests the user to a character. Your program should be able to
print out comments based on the entered character.

Refer to the following:

F Freshman

S Sophomore

Tel. Nos.: (086) 827-3741 Email: info@snsu.edu.ph


URL: snsu.edu.ph
Republic of the Philippines
SURIGAO DEL NORTE STATE UNIVERSITY
Narciso Street, Surigao City 8400, Philippines
“For Nation’s
Greater Heights”

J Junior

R Senior

If the user enters number which is out of range, the comment should be “ Character entered is
invalid”.

10. Create a program that would if the inputted number is a positive or negative number.

11. Create a program that would test if the inputted number is an even or odd number.

Prepared by:

Dr. Analyn S. Morite

Professor

Tel. Nos.: (086) 827-3741 Email: info@snsu.edu.ph


URL: snsu.edu.ph

You might also like