wisemonkeys logo
FeedNotificationProfileManage Forms
FeedNotificationSearchSign in
wisemonkeys logo

Blogs

Student Grade Calculator in LISP

profile
Zaobiya Khan
Jul 16, 2025
2 Likes
1 Discussions
1 Reads

The program performs the following key functions:


  1. Takes user input for the three scores, each between 0 and 100.
  2. Validates that the entered scores are numbers within the correct range.
  3. Calculates the average of the three scores.
  4. Determines the letter grade (A–F) based on the calculated average:


A: 90–100

B: 80–89

C: 70–79

D: 60–69

F: below 60


Displays the results: individual scores, average score (formatted to 2 decimal places), and final letter grade.


Program:-


;; Student Grade Calculator

(defun calculate-grade (total)

(cond ((>= total 90) "A")

((>= total 80) "B")

((>= total 70) "C")

((>= total 60) "D")

(t "F")))


(defun get-valid-score (prompt min max)

(format t "~%~A (Enter score between ~D and ~D): " prompt min max)

(let ((score (read)))

(if (and (numberp score) (>= score min) (<= score max))

score

(progn

(format t "Invalid score! Please enter a number between ~D and ~D~%" min max)

(get-valid-score prompt min max)))))


(defun main ()

(format t "~%Welcome to Student Grade Calculator~%")

;; Get scores for different components

(let* ((assignment (get-valid-score "Enter Assignment score" 0 100))

(midterm (get-valid-score "Enter Midterm score" 0 100))

(final (get-valid-score "Enter Final exam score" 0 100))

;; Calculate weighted total

(total (/ (+ assignment midterm final) 3))

(final-grade (calculate-grade total)))

;; Display results

(format t "~%Results:~%")

(format t "Assignment Score: ~D~%" assignment)

(format t "Midterm Score: ~D~%" midterm)

(format t "Final Score: ~D~%" final)

(format t "Average Score: ~,2F~%" total)

(format t "Final Grade: ~A~%" final-grade)))


;; Run the program

(main)


Output:


Comments ()


Sign in

Read Next

CYBERPEACEKEEPING: NEW WAYS TO PREVENT AND MANAGE CYBERATTACKS

Blog banner

Sniffing: A Cyber Security Threat

Blog banner

E-BUSINESS RISK MANAGEMENT

Blog banner

Data Security must be your Priority!

Blog banner

You Get Everyone, But No One Gets You: The Lonely Side of High Emotional Intelligence

Blog banner

What is Virtual Memory

Blog banner

TRAIN TRAVELING

Blog banner

Topic: Sessions in Operating system

Blog banner

Incorporating Automation into Digital Forensics.

Blog banner

The Peephole

Blog banner

How User Data Shapes Personalised Campaigns

Blog banner

Functions Of Operating Systems

Blog banner

Evolution of OS

Blog banner

FREE VERSION OF G-MAIL

Blog banner

CoWIN

Blog banner

Process and Threading

Blog banner

This is my first blog.

Blog banner

The House ??of Patola Designs: Traditional Weaves with a Modern Twist

Blog banner

Reconnaissance

Blog banner

Threads

Blog banner

Android Application Components and Activity Lifecycle

Blog banner

"Audit" In Data Science

Blog banner

Advanced Persistent Threats (APTs)

Blog banner

Multiprocessor and Multicore Organization

Blog banner

Stop Racism

Blog banner

THE INPACT OF SOCIAL MEDIA!

Blog banner

Deadlock

Blog banner

RAID

Blog banner

Decoding the Weave — How to Identify Original Patola Art on a Fabric

Blog banner

(Input/Output) in os

Blog banner

Importance of internet

Blog banner

Data Storytelling: Turning Analysis into Business Action

Blog banner

Disk cache

Blog banner

Virtual memory

Blog banner

Partnership in Learning: How Parent Involvement Shapes a Child’s Early Education

Blog banner

Animal’s have my heart

Blog banner

"Games and the future"

Blog banner

Data-Driven Prediction of Virtual Item Prices in Online Games

Blog banner

Zoho

Blog banner

The Right way of cooking

Blog banner

STARVATION

Blog banner

Building a Simple Doctor Appointment System in Common Lisp

Blog banner