0% found this document useful (0 votes)
17 views6 pages

Carter's

The document outlines an assessment on Computer Programming II, detailing an algorithm for calculating students' GPAs based on their course scores and credit units. It includes a flowchart and Python code that implements a structured approach to gather student data and compute GPAs for a maximum of 20 students across 5 courses. The program does not identify the best student but provides a framework for GPA calculation and data storage.

Uploaded by

johnniedhale
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)
17 views6 pages

Carter's

The document outlines an assessment on Computer Programming II, detailing an algorithm for calculating students' GPAs based on their course scores and credit units. It includes a flowchart and Python code that implements a structured approach to gather student data and compute GPAs for a maximum of 20 students across 5 courses. The program does not identify the best student but provides a framework for GPA calculation and data storage.

Uploaded by

johnniedhale
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/ 6

AN

ASSESSMENT
ON
COMPUTER PROGRAMMING II

WITTEN BY:
ETA KELVIN-CARTER EFOLI
MATRIC NUMBER: 20/097344053

DEPARTMENT OF PHYSICS (E.C.T)

FACULTY OF PHYSICAL SCIENCES

UNIVERSITY OF CALABAR, CALABAR

October, 2023
ALGORITHM

STEP 1: START

STEP 2: SET K= 1

STEP 3: INPUT NAME OF STUDENTS

STEP 4: INPUT MATRIC NUMBER OF STUDENTS

STEP 5: ENTER SCORE OBTAINED IN EACH OF THE 5 COURSES

STEP 6: INPUT THE CREDIT UNIT OF EACH OF THE 5 COURSES

STEP 7: INPUT CREDIT POINT FOR EACH OF THE 5 COURSES

STEP 8: COMPUTE THE SUM OF THE OBTAINABLE SCORE POINT

STEP 9: COMPUTE THE SUM OF THE OBTAINED OBTAINED SCORE


POINT

STEP 10: LET GPA= (SUM OF OBTAINED SCORE/SUM OF


OBTAINABLE SCORE)*5

STEP 11: PRINT NAME OF STUDENT

STEP 12: PRINT MATRIC NUMBER OF STUDENT

STEP 13: PRINT SCORE OBTAINED IN EACH OF THE 5 COURSES

STEP 14: PRINT THE OBTAINABLE SCORE POINT IN EACH OF THE


5 COURSES WITH THEIR CREDIT UNIT

STEP 15: PRINT OF THE OBTAINED SCORE POINT IN EACH OF THE


5 COURSES WITH THEIR CREDIT POINTS OBTAINED

STEP 16: PRINT OBTAINED GP

STEP 17: SET K = K + 1

STEP 18: IF K < 20 THEN GO TO STEP 3, ELSE GO TO STEP 19

STEP 19: END


FLOW CHART

START

K 1

INPUT NAME OF STUDENTS & MATRIC NUMBER OF


STUDENT

ENTER THE SCORE OBTAINED, CREDIT UNIT & CREDIT


POINT IN EACH OF THE 5 COURSES

OBTAINABLE SCORE POINT SUM OF (MATH 101, CHM 101, PHY101,


GSS101, CSC 101 CREDIT UNIT) * (OBTAINABLE CREDIT POINT)

OBTAINED SCORE POINT SUM OF (MATH 101, CHM 101, PHY101, GSS101, CSC
101 CREDIT UNIT) * (OBTAINED CREDIT POINT)

GPA (SUM OF OBTAINED SCORE/OBTAINABLE SCORE) *5

PRINT NAME OF STUDENT, PRINT MATRIC NUMBER OF STUDENT,


CREDIT UNIT, CREDI POINT, OBTAINABLE & OBTAINED SCORE IN
EACH OF THE 5 COURSES, OBTAINABLE & OBTAINED SCORE
POINT & OBTAINED GP

K K+1

K ≤ 20
END

PROGRAMMING LANGUAGE: PYTHON

Num_students = 20

Num_courses = 5

Students = []

Class student:

def _init_(self, name, matric_number):

self.name = name

self.matric_number = matric_number

self.courses = []

def add_courses(self, course_name, score, credit_unit, credit_points):

self.courses.append({‘course_name’: course_name, ‘score’: score, ‘credit_unit’: credit unit,


‘credit_points’: credit_points})

def calculate_gpa(self):

total_credit_points = 0

total_credit_units = 0

for course in self.courses:

total_credit_points += course[‘credit_points’]

total_credit_units += course[‘credit_unit’]

gpa = total_credit_points/ total_credit_units

return gpa

for I in range(num_students):

print(f”\nstudent {i+1}”)
name = input(“Enter student name: “)

matric_number = input(“Enter matric number: “)

student = student(name, matric_number)

for j in range (num_courses):

print(f”\ncourse {j+1}”)

course_name = input(“Enter course name: ”)

score = float(input(“Enter score: “))

credit_unit = int(input(“Enter credit unit: ”))

credit_points = score * credit_unit

student.add_course(course_name, score, credit_unit, credit_points)

students.append(student)

print(“\nGrade Point Averages(GPA):”)

for student in students:

gpa = student.calculate_gpa()

print(f”student: {student.name}\tmatric Number: {student.matric_number}\tGPA: {gpa}”)


1. The loop employed in the design of the program is a nested loop. There is an outer loop that
iterates over each student, and within that loop, there is an inner loop that iterates over
each course choice of the student. The nested loop allows the program to gather inputs for
all the courses chosen by each student.

2. The approach employed in the deign of the program is a structured approach using
procedural programming. The program follows a linear sequence of steps, starting with
inputting student details, then accepting course choices, scores and credit unit for each
student, and finally calculating and storing the GPA for each student. The program uses
function like input and print statements to interact with the user and perform computations.

3. The data input for the program includes:


 Name of the student
 Matric of the student
 Course choices (5) for each student
 Scores obtained in each of the (5) courses
 Credit units for each of the (5) courses

4. The program does not determine or identify the “best” student in the class.
It collects data for all students, calculates their respective GPAs, and stores
the information. To determine the best student, we would need to define a
criteria for determining the best, such as the highest GPA, and then iterate
over the student data to find the student(s) with the highest GPA.

5. The program consists of one main module, which includes the overall flow
of the program and the primary logic for accepting inputs, calculating GPAs,
and storing data. There are no submodules defined in the given program.
However, we can further modularize the program by encapsulating specific
functionalities into separate functions if needed (e.g) functions for input
validation , GPA calculation, etc.

You might also like