0% found this document useful (0 votes)
39 views11 pages

Cmpe30022 Assignment3

Uploaded by

Ireanne Omega
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
39 views11 pages

Cmpe30022 Assignment3

Uploaded by

Ireanne Omega
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 11

Republic of the Philippines POLYTECHNIC

UNIVERSITY OF THE PHILIPPINES COLLEGE


OFENGINEERING
COMPUTER ENGINEERING DEPARTMENT

CMPE 30022

Programming Logic and Design

ASSIGNMENT NO.

3
SELECTION STATEMENTS
Submitted by:
IREANNE N. OMEGA

Year and Section:


BSCOE 1-2

Submitted to:
Julius S. Cansino

Date Submitted:
December 31,202
Exercise 5.1
Write a program that will compute for the student’s average grade and will
display the Status of the student.
● The user will input the following:
○ Name (String)
○ Math (int)/(float)
○ Science (int) (float)
○ English (int) (float)
● Display the average grade in 2 decimal places
● if the average grade >= 75, display
Congratulations!
You passed the semester
else display
You failed the semester

SOURCE CODE:

OUTPUT RUN:
Exercise 5.2
Create a program using ladderized-if statement to display student’s
remarks based on the average grade. Combined/Compound condition (using
logical operator such as AND/OR) is not allowed.

Average Grade Remarks Sample Runs:


95-100 Excellent Enter average grade: 96
90-94 Outstanding Excellent
85-89 Very Good -------------------------------
80-84 Good Enter average grade: 90
75-79 Poor Outstanding
Below 75 (0-74)Failed -------------------------------
Enter average grade: 73
Failed
-------------------------------
Enter average grade: 101
Grade out of range
-------------------------------
Enter average grade: -1
Grade out of range

SOURCE CODE:

OUTPUT RUN:
Enter average grade: 96
Excellent
Enter average grade: 90
Outstanding

Enter average grade: 73


Failed

Enter average grade: 101


Grade out
of range

Enter average grade: -1


Grade out
of range
Exercise 5.3
Write a program that will compute for the student’s average grade and
will display the Status of the student.
● The user will input the following:
○ Name (String)
○ Math (int) (float)
○ Science (int) (float)
○ English (int) (float)
● Display the average grade in 2 decimal places
● if the average grade >= 75 and all the subject grades >= 75, display
Congratulations!
You passed the semester
● if the average grade >= 75 but if there is/are one/two subject
grade(s) below 75, display
Congratulations!
You passed the semester,
but you need to retake the following subject(s):
-list of failed subject(s)
● if the average grade < 75, display
“You failed the semester”

Sample Run:
Enter Name: Christian
Enter Math: 96
Enter Science: 90
Enter English: 89
Average Grade: 91.67
Congratulations!
You passed the semester

SOURCE CODE:
OUTPUT RUN:
Exercise 5.4
Write a program that will check the employees’ years in service and
office.
● The user will input number of years in service and the
following offices: IT, ACCT, HR.
● Check the following conditions given on the table.
● The program should display the amount

Sample Run: Sample Run:


Enter years in service: 15 Enter years in service: 8
Enter office: IT Enter office: HR
Amount given: 10000 Amount given: 7500

Years in Service
Office
More than or equal to 10 years Below 10 years

IT 10000 5000

ACCT 12000 6000

7500
HR 15000

SOURCE CODE:
OUTPUT RUN:
Enter years in service: 15
Enter office: IT
Amount given: 10000

Enter years in service: 8


Enter office: HR
Amount given: 7500

More than or equal to 10 years


Below 10 years
Exercise 5.5
Write a program that accepts three numbers. The program should
determine the highest and the lowest numbers. The program should
display the sum of the lowest and highest numbers on the screen. You
can use any selection control structures.

Sample Run:
Enter number1: 5
Enter number2: 7
Enter number3: 3
Lowest: 3
Highest: 7
Sum: 10

SOURCE CODE:
OUTPUT RUN:

You might also like