Write pseudocode to look at 2 variables a students score on
Write pseudocode to look at 2 variables – a student’s score on a test, and that student’s overall average score in the class – to determine if the student is keeping track with her/his average performance in class. If the test score is strictly better than the average, then set a variable called PositiveProgress to TRUE. Otherwise, the variable PositiveProgress should be set to FALSE.
Solution
Pseudocode:
BEGIN
// Declaring a variables
DECLARE StudentScore AS FLOAT;
DECLARE AverageClassScore AS FLOAT;
DECLARE PositiveProgress AS BOOLEAN;
// Initializing a variables
INITIALIZE PositiveProgress = FALSE;
// Accepting a variables
PROMT \"Enter Student Test Score: \" AND STORE IN StudentScore;
PROMT \"Enter Average Class Score: \" AND STORE IN AverageClassScore;
// Validating Student Score
IF isNaN(StudentScore) THEN
PRINT \"Please enter a valid Student Test Score.\"
EXIT;
END IF;
// Validating Average Class Score
IF isNaN(AverageClassScore) THEN
PRINT \"Please enter a valid Average Class Score.\"
EXIT;
END IF;
// Calculating Performance of a Student
PositiveProgress = cal_performance( AverageClassScore, PositiveProgress );
// Printing Final result
PRINT \" Performance of Student: \" +PositiveProgress;
END;
// Calculating Performance of a Student Method
SUB cal_performance( AverageClassScore, PositiveProgress )
DECLARE PositiveProgress AS BOOLEAN;
IF ( StudentScore >= AverageClassScore ) THEN
PositiveProgress = TRUE;
ELSE
PositiveProgress = FALSE;
END IF;
RETURN PositiveProgress;
END SUB;
