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

Cyber Bullying - Neeta Vonkamuti

Blog banner

Outlook mail

Blog banner

A Statistical Analysis of Player Performance and their Value in cricket

Blog banner

Save Girl Child

Blog banner

10 Unsolved Mysteries all over the world

Blog banner

The application udemy

Blog banner

The Role of Cyber Forensics in Addressing Cyber security Challenges in Smart Cities

Blog banner

The Features of Blockchain

Blog banner

Hot Mango Pickle (Methiyu)

Blog banner

New Ransomware Encrypts Your Android And Then Changes PIN Lock

Blog banner

Information Technology In E- Commerce

Blog banner

Next time you click on "Remind me later", think twice!

Blog banner

Zomato (Income Sources)

Blog banner

How to lose belly fat

Blog banner

Automating OSINT tasks for efficient Cyber Forensics Investigations

Blog banner

Concept and definition of m-commerce

Blog banner

semaphores in os

Blog banner

Social engineering in cyber security

Blog banner

10 Types of Friends in every friend group

Blog banner

Penetration Testing

Blog banner

Top 10 Logos and their meanings

Blog banner

LINUX VSERVER VIRTUAL MACHINE ARCHITECTURE

Blog banner

Internet of Things

Blog banner

Deadlock and Starvation

Blog banner

Hypothesis Testing in Data Science

Blog banner

Virtual memory

Blog banner

OPERATING SYSTEM

Blog banner

What Makes a School Safe, Supportive, and Student-Friendly

Blog banner

How the mobile IP is used in GSM architecture.

Blog banner

Modern Operating Systems.

Blog banner

Corporate Discipline.

Blog banner

IT RISK

Blog banner

Cyber Crime Investigation In The Era Of Big Data

Blog banner

A BLOG ON MYSQL

Blog banner

1.1 basic elements

Blog banner

Top 4 Places To Stay In Copenhagen

Blog banner

Steganography and Steganalysis

Blog banner

EMAIL INVESTIGATION

Blog banner

CBSE + International Thinking: How Indian Schools Are Producing World-Ready Students

Blog banner

Raising mental health burden: A global and Indian perspective

Blog banner

This Windows 11 encryption bug may cause data damage

Blog banner

Modern operating system

Blog banner