wisemonkeys logo
FeedNotificationProfileManage Forms
FeedNotificationSearchSign in
wisemonkeys logo

Blogs

Student Grade Calculator in LISP

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

Deadlocks in operating system

Blog banner

KASHMIR TRIPS

Blog banner

Cyber Attacks -- Trends Patterns and Security Countermeasures

Blog banner

Bharat Maps

Blog banner

TECHNOLOGY : BOON OR CURSE ?

Blog banner

Memory Management

Blog banner

Vikrant’s first blog

Blog banner

Multiprocessor and Multicore Organization

Blog banner

PROCESS STATE:

Blog banner

Memory

Blog banner

Mango Raisin Chutney (sweet mango raisin spread)

Blog banner

Data Exfiltration

Blog banner

Anomaly Detection in Behavioral Data Using Machine Learning

Blog banner

Pilgrimage at LOC: A privilege and a paradox

Blog banner

All you need to know about Website Traffic

Blog banner

Disk cache

Blog banner

Deadlock and Starvation

Blog banner

The role of artificial intelligence in automating digital forensic analysis.

Blog banner

Fossil Hunting 101 at the Peace River, Arcadia, Florida, USA

Blog banner

5 Powerful Mindset Shifts To Make 2026 Your Breakthrough Year

Blog banner

Risk mitigation and management

Blog banner

THE INPACT OF SOCIAL MEDIA!

Blog banner

Data Mapping

Blog banner

ASANA- A Management System.

Blog banner

VIRTUAL MEMORY

Blog banner

Elegant fashion style

Blog banner

Oracle Corporation

Blog banner

File management

Blog banner

Instagram

Blog banner

Modern operating system

Blog banner

The Role of Frontline Managers in Driving Workplace Performance and Customer Satisfaction

Blog banner

FRIENDSHIP

Blog banner

Business Intelligence v/s Big Data

Blog banner

Cyber-crime Investigation and Future Directions

Blog banner

DEVELOPMENTS LEADING TO MODERN OPERATING SYSTEMS

Blog banner

Google App Engine

Blog banner

AutoML: The Future of Automated Data Science

Blog banner

'C', 'C++' and 'Java': Head-to-Head

Blog banner

Beyond the Track: Why the Best Hotel in Arcadia, Florida, Completes Your IMSA Sebring Getaway

Blog banner

Cloud Computing

Blog banner

Social Network Analysis: Ek Naya Nazariya Data Science Mein

Blog banner

?How long does wisdom tooth pain last?

Blog banner