Prompt
Answer
Pseudo Code for Grade Calculation Program
Overview
This pseudo code represents the logic for a grading system that:
- Takes assessment details from users.
- Collects student grades for each assessment.
- Calculates individual grades and class averages.
Functions
Calculate Grade Function
FUNCTION calculateGrade(percentage):
IF percentage >= 85:
grade = 'High Distinction'
ELSE IF percentage >= 75:
grade = 'Distinction'
ELSE IF percentage >= 65:
grade = 'Credit'
ELSE IF percentage >= 50:
grade = 'Pass'
ELSE:
grade = 'Fail'
RETURN grade
Main Program Logic
BEGIN MAIN
// Input number of assessments
numAssessments = GET INTEGER INPUT("Enter the number of assessments:")
// Initialize lists for assessment names and values
assessmentNames = []
assessmentValues = []
// Loop to collect assessment names and their respective marks
FOR var FROM 0 TO numAssessments - 1:
nam = GET STRING INPUT("The name of assessment" + (var + 1))
val = GET FLOAT INPUT("How many marks is the " + nam + " worth:")
ADD nam TO assessmentNames
ADD val TO assessmentValues
// Validate total marks of assessments
IF SUM(assessmentValues) != 100:
PRINT "Assessment VALUE ERROR: try to give different input:"
EXIT
// Input number of students
numStudent = GET INTEGER INPUT("Kindly enter the number of students:")
// Initialize variables for class average and top student
total_class = 0
topperNAME = ""
topper_student = 0
// Loop to collect individual student scores
FOR j FROM 0 TO numStudent - 1:
name_of_student = GET STRING INPUT("Enter name:")
total_no_student = 0
// Loop to collect each student's marks for all assessments
FOR var FROM 0 TO numAssessments - 1:
maximumMarks = assessmentValues[var]
assessmentName = assessmentNames[var]
total_mark = GET INTEGER INPUT("What did " + name_of_student + " get out of " + maximumMarks + " in the " + assessmentNames[var] + "?")
// Ensure total_mark is within bounds
IF total_mark < 0:
total_mark = 0
ELSE IF total_mark > maximumMarks:
total_mark = maximumMarks
total_no_student = total_no_student + total_mark
// Calculate percentage and grade for current assessment
per = (total_mark / maximumMarks) * 100
score = calculateGrade(per)
PRINT total_mark + " out of " + maximumMarks + " is a " + score + "."
// Calculate final score for the student
final_score_student = calculateGrade((total_no_student / 100) * 100)
PRINT name_of_student + " has total mark of " + total_no_student + " , " + final_score_student
PRINT "All marks entered!"
total_class = total_class + total_no_student
// Identify topper student
IF total_no_student > topper_student:
topper_student = total_no_student
topperNAME = name_of_student
// Calculate class average and corresponding grade
Average = total_class / numStudent
C_average = calculateGrade(Average)
PRINT "Average is " + FORMAT(Average, 0) + " (" + C_average + ")."
PRINT "Top student is " + topperNAME + " with score of " + topper_student + "."
END MAIN
Conclusion
This pseudo code clearly outlines the steps involved in calculating grades for assessments and students, ensuring clarity and simplicity for understanding the program's logic and structure.
Description
A structured pseudo code outlining a grading system that inputs assessment details, collects student grades, calculates individual scores, and determines class averages and top students.
More Pseudo Code Generators
Apache Flink Pseudo Code Generator Apache Pig Pseudo Code Generator Azure Data Factory Pseudo Code Generator C/C++ Pseudo Code Generator CouchDB Pseudo Code Generator DAX Pseudo Code Generator Excel Pseudo Code Generator Firebase Pseudo Code Generator Google BigQuery Pseudo Code Generator Google Sheets Pseudo Code Generator GraphQL Pseudo Code Generator Hive Pseudo Code Generator Java Pseudo Code Generator JavaScript Pseudo Code Generator Julia Pseudo Code Generator Lua Pseudo Code Generator M (Power Query) Pseudo Code Generator MATLAB Pseudo Code Generator MongoDB Pseudo Code Generator Oracle Pseudo Code Generator PostgreSQL Pseudo Code Generator Power BI Pseudo Code Generator Python Pseudo Code Generator R Pseudo Code Generator Redis Pseudo Code Generator Regex Pseudo Code Generator Ruby Pseudo Code Generator SAS Pseudo Code Generator Scala Pseudo Code Generator Shell Pseudo Code Generator SPSS Pseudo Code Generator SQL Pseudo Code Generator SQLite Pseudo Code Generator Stata Pseudo Code Generator Tableau Pseudo Code Generator VBA Pseudo Code Generator