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

The most common internet security threats

Blog banner

Deadlock and Starvation

Blog banner

Starvation

Blog banner

Big Data Architecture

Blog banner

RSA (Rivest-Shamir-Adelman) Algorithm

Blog banner

Deadlock in Operating System

Blog banner

Real Time Scheduling

Blog banner

Firewall / IDS Evasion Techniques

Blog banner

Technical SEO : Total Guide

Blog banner

What is Data, Information and Knowledge?

Blog banner

Some web vulnerabilities

Blog banner

Concurrency and Deadlocks

Blog banner

Explain DBMS in Brief

Blog banner

Evolution of Operating system

Blog banner

Direct memory access

Blog banner

Mental Health

Blog banner

LinkedIn: Watch out for these 7 upcoming updates in 2023

Blog banner

How GIS in Agriculture Eliminates Guesswork

Blog banner

Interrupts in operating system.

Blog banner

Yoga in INDIA and ABROAD

Blog banner

The Peephole

Blog banner

Virtual Machine

Blog banner

Bots and Cyber Security

Blog banner

Deming’s Process

Blog banner

Mariana Trench: The deepest depths

Blog banner

Different memory allocation strategies

Blog banner

How to setup a professional looking business account on Instagram?

Blog banner

Kernel Memory Allocation In Linux.

Blog banner

Article on team management software

Blog banner

Study on cyber and network forensic in computer security management

Blog banner

MAILFENCE

Blog banner

Threads

Blog banner

Sniffing: A Cyber Security Threat

Blog banner

Android Application Components and Activity Lifecycle

Blog banner

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

Blog banner

Importance of Education

Blog banner

Facebook Shut Down an AI Program!!! Facebook AI bots became Terminators???

Blog banner

Studying Denial of service attack using DOSHTTP tool

Blog banner

Instagram

Blog banner

BENIFITS OF YOGA

Blog banner

How to Avoid being a Victim of Cybercrime

Blog banner

computer security

Blog banner