START
// Step 1: Password Validation
INPUT full name
SET courseCode = "CMP2103"
SET attempts = 0
WHILE attempts < 3
PROMPT user to enter course code as password
IF password == courseCode
DISPLAY "Password validated. Welcome!"
BREAK
ELSE
DISPLAY "Incorrect password. Try again."
INCREMENT attempts by 1
IF attempts == 3
DISPLAY "Program terminated due to incorrect password."
EXIT
// Step 2: Main Menu Loop
DO
DISPLAY "Menu: 1. Enter Marks and Calculate GPA (Max GPA = 5), 2. Calculate Age, 3. Exit"
INPUT choice
SWITCH(choice)
CASE 1:
// Step 3: Marks Input and GPA Calculation
PROMPT user for number of subjects
SET totalMarks = 0
FOR each subject
DO
PROMPT user for a mark between 0 and 100
WHILE mark is invalid
ADD mark to totalMarks
CALCULATE GPA = (totalMarks / (number of subjects * 100)) * 5
DISPLAY GPA (Max GPA = 5)
BREAK
CASE 2:
// Step 4: Age Calculation
GET current date
PROMPT user for birth date (DD/MM/YYYY)
CALCULATE age in years, months, and days
ADJUST age calculation for days and months if needed
DISPLAY age in years, months, and days
BREAK
CASE 3:
DISPLAY "Exiting program."
EXIT
DEFAULT:
DISPLAY "Invalid input. Please select a valid option."
WHILE choice != 3
END