wisemonkeys logo
FeedNotificationProfileManage Forms
FeedNotificationSearchSign in
wisemonkeys logo

Blogs

Student Grade Calculator in LISP

profile
Zaobiya Khan
Jul 16, 2025
2 Likes
1 Discussions
4 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

Race Condition in Operating Theatre

Blog banner

Data is an asset and it is your responsibility!

Blog banner

Rain

Blog banner

Continual service improvement vs maintenance phase in IT

Blog banner

What Your Music Taste Reveals About Your Personality

Blog banner

Virtual Memory

Blog banner

MULTITHREADING:ENHANCEING PERFORMANCE AND EFFICIENCY IN COMPUTING

Blog banner

Overcoming the bedtime brushing Battle with Dr. Roxanne Irani, Dentist in Maroubra

Blog banner

Famous Indian dishes that where misunderstood to be Indian

Blog banner

Solving Problems with AI: The Power of Search Algorithms

Blog banner

Supervised and unsupervised learning

Blog banner

Article on different management system

Blog banner

Multiprocessor and Multicore Organization

Blog banner

Processing Crime and Incident Scenes

Blog banner

Skills An Ethical Hacker Must Have

Blog banner

Emerging threats in cyber Forensics

Blog banner

What is semaphore in operating system?

Blog banner

AI and Cyber Security

Blog banner

Social Engineering Deceptions and Defenses

Blog banner

Introduction to Virtual Memory - 080

Blog banner

Inventory management software system

Blog banner

Why Your Child Cries at Drop-Off and How Preschools Handle It Gently

Blog banner

How to Find the Right Therapist For Me?

Blog banner

Yahoo! mail

Blog banner

AI & Data Science in Healthcare – Predicting diseases, medical imaging analysis

Blog banner

A Survey of Anti-Forensic Techniques: Methods, Challenges, and Countermeasures

Blog banner

Education: Key to your Prosperity

Blog banner

NETSUITE

Blog banner

Why Time Management Is the Secret to College Success (and How to Master It)

Blog banner

Lemon and Chilli Pickle (Limbu Mirchi Achar)

Blog banner

Types of Hackers

Blog banner

Data Lake

Blog banner

RAID

Blog banner

This is my first blog.

Blog banner

Review on Recovering Deleted Files

Blog banner

How Industrial Gratings Improve Safety, Drainage, and Workplace Efficiency?

Blog banner

Odoo

Blog banner

Explain Multiprocessors

Blog banner

Beatbox

Blog banner

Apache Kafka

Blog banner

Developments in Modern Operating Systems

Blog banner

Social media

Blog banner