0% found this document useful (0 votes)
45 views24 pages

CA Final Report

The code implements an online grading system and GPA calculator with the following functionality: 1. It asks the user to enter the number of subjects and then prompts for the grade and credit hours for each subject. 2. It uses procedures to validate input, compute grade points based on grades, sum the grade points and credit hours, and calculate the GPA. 3. The output displays the calculated GPA to 2 decimal places along with a thank you message before exiting.

Uploaded by

Ayesha Bibi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
45 views24 pages

CA Final Report

The code implements an online grading system and GPA calculator with the following functionality: 1. It asks the user to enter the number of subjects and then prompts for the grade and credit hours for each subject. 2. It uses procedures to validate input, compute grade points based on grades, sum the grade points and credit hours, and calculate the GPA. 3. The output displays the calculated GPA to 2 decimal places along with a thank you message before exiting.

Uploaded by

Ayesha Bibi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 24

 

                         
 
 
 
 
 
 
 
 
 
 
 
6/24/2021  CA PROJECT
 
 
 
REPORT
                                  
 

Submitted to:
Maam Qurat-ul-ain
Submitted by:
Hafza Eman(19-CS-04)
Samra Ashraf(19-CS-34)
Rehana Sanam(19-CS-47)
Ayesha Bibi(19-CS-48)
 
  

 
 
 
                                            
 
   
Topic:
Topic of Project is “GPA CALCULATR AND ONLINE GRADING SYSTEM”

Description:
       This system design is for the benefits of teachers, principals, administrators, and students as compared to
the current manual system. Teachers can easily maintain grades of each student. The principal can monitor
students and teachers and tasks accomplished. 

Requirements:
Hardware Requirements: - The project is implemented on a Windows operating system so Window
operating system should install.

Software requirements: - An Emu8066 should installed, which provide Visual interface and is very
easy to work with. We can watch registers, flags and memory while program executes.

Variables:
Variable that are used in our program are:

Newline, welcome, thanks, ask, invalid_, subject, grade, invalidG, invalid, creditHour, show, nsub, i, var,
total, tch, result

Labels:
Labels are following: 

1. GPA 
2. TakeS 
3. Next 
4. takeC 
5. notValid 
6. not_Valid 
7. askForAgain 
8. Choice 
9. ExitP 
10. Up 
11. A 
12. AA 
13. A_ 
14. B 
15. BB 
16. BPositive 
17. BNegative 
18. C 
19. CC 
20. CPositive 
21. CNegative 
22. D 
23. DD 
24. DPositive 
25. DNegative 
26. F 
27. invalidGrade 
28. Exit 
29. Exitt 
30. Skip 

Procedures:
1. displayChr 
2. displayString 
3. input 
4. compute 
5. Invalid 
6. multiply 
7. Sum 
8. ComputeResult 
9. Display

Input:
The user will enter following inputs:

 Enter the number of subjects.


 Enter the grades of subjects.
 Enter the credit hours of that subject.

Output:
Code:
.MODEL small
.STACK 256
.DATA
; Declaration of variables
newline DB 0DH,0AH,"$"
welcome DB "********** Welcome to the GPA Calculator ***********$"
thanks DB 0DH,0AH,0DH,0AH,"Thanks for using our program. See you again... $"
ask DB 0DH,0AH,0DH,0AH,"Now What you want to do?",
DB 0DH,0AH,"1- GPA "
DB 0DH,0AH,"2- Exit ",0DH,0AH," $"
invalid_ DB 0DH,0AH,"Your input is not valid. Please enter a valid input $"
subject DB 0DH,0AH,0DH,0AH,"How many subjects do you have in your semester?",0DH,0AH," $"
grade DB 0DH,0AH,0DH,0AH,"Enter the grade of subject $"
invalidG DB 0DH,0AH,"The grade you entered is invalid. Please enter a valid grade $"
invalid DB 0DH,0AH,"Your input is not valid please enter a valid input from 1 to 9.",0DH,0AH," $"
creditHour DB 0DH,0AH,"Now enter the credit hours of that subject",0DH,0AH,"$"
show DB 0AH,0DH,"Your GPA is : $"
nSub DB ?
i DB ?
var DB ?,?
total DB 0,0
tch DB 0
result DB ?,?
.CODE
main PROC
.startup
lea dx,welcome
call displayString

GPA:
mov i,0
lea dx,subject
call displayString
TakeS:
call input
mov cl,al
sub cl,30h
cmp cl,0
JE not_valid
cmp cl,9
JG not_valid
Next:
inc i
lea dx,grade
call displayString
mov dl,i
add dl,30h
call displayChr
lea dx,newline
call displayString
call input
mov bl,al
call compute
lea dx,creditHour
call displayString
takeC:
call input
sub al,30h
cmp al,0
JE notvalid
cmp al,9
JG notvalid
add tch,al
mov bl,al
call multiply
call sum
cmp cl,i
JNE Next
call ComputeResult

; Displaying the result


lea dx,show
call displayString
mov dl,result
add dl,30h
call displayChr
mov dl,'.'
call displayChr
mov bx,0
mov dl,result+1
call displayChr
JMP askForAgain

notValid:
lea dx,invalid
call displayString
JMP takeC

not_Valid:
lea dx,invalid
call displayString
JMP takeS

askForAgain:
lea dx,ask
call displayString
lea dx,newline
call displayString

Choice:
call input
cmp al,31h
JE GPA
cmp al,32h
JE ExitP
lea dx,invalid_
call displayString
JMP Choice

ExitP:
lea dx,thanks
call displayString
.EXIT
main ENDP
ret

displayChr PROC
mov ah,02h
int 21h
ret
displayChr ENDP

displayString PROC
mov ah,09h
int 21h
ret
displayString ENDP

input PROC
mov ah,01h
int 21h
ret
input ENDP

compute PROC
up:
cmp bl,'A'
JE A
cmp bl,'B'
JE B
cmp bl,'C'
JE C
cmp bl,'D'
JE D
cmp bl,'F'
JE F
call invalidGrade
A:
call input
cmp al,'+' ; A+ grade
JE AA
cmp al,0DH ; A grade
JE AA
cmp al,'-' ; A- grade
JE A_
call invalidGrade
AA:
mov var,4
mov var+1,0
JMP Exit
A_:
mov var,3
mov var+1,7
JMP Exit
B:
call input
cmp al,'+' ; B+ grade
JE BPositive
cmp al,'-' ; B- grade
JE BNegative
cmp al,0DH ; B grade
JE BB
call invalidGrade
BB:
mov var,3
mov var+1,0
JMP Exit
BPositive:
mov var,3
mov var+1,3
JMP Exit
BNegative:
mov var,2
mov var+1,7
JMP Exit
C:
call input
cmp al,'+' ; C+ grade
JE CPositive
cmp al,'-' ; C- grade
JE CNegative
cmp al,0DH ; C grade
JE CC
call invalidGrade
CC:
mov var,2
mov var+1,0
JMP Exit
CPositive:
mov var,2
mov var+1,3
JMP Exit
CNegative:
mov var,1
mov var+1,7
JMP Exit
D:
call input
cmp al,'+' ; D+ grade
JE DPositive
cmp al,'-' ; D- grade
JE DNegative
cmp al,0DH ; D grade
JE DD
call invalidGrade
DD:
mov var,1
mov var+1,0
JMP Exit
DPositive:
mov var,1
mov var+1,3
JMP Exit
DNegative:
mov var,0
mov var+1,7
JMP Exit
F:
mov var,0
mov var+1,0
JMP Exit

invalidGrade:
lea dx,invalidG
call displayString
lea dx,newline
call displayString
call input
mov bl,al
JMP up

Exit:
ret
compute ENDP

multiply PROC
mov ax,0h
mov al,var+1
mul bl
mov var+1,al
mov ax,0h
mov al,var
mul bl
mov var,al
mov bl,var+1

mov ax,0h
mov al,var+1
mov bl,10
div bl
cmp al,0
JE Exit_
add var,al
mov var+1,ah
Exit_:
ret
multiply ENDP

sum PROC
mov bl,var
add total,bl
mov bl,var+1
add total+1,bl
mov bl,total

mov ax,0h
mov al,total+1
mov bl,10
div bl
cmp al,0
JE Exitt
add total,al
mov total+1,ah
Exitt:
ret
sum ENDP
ComputeResult PROC
mov ax,0h
mov al,total
mov bl,tch
div bl
mov result,al
mov al,ah
cmp al,0
JE Skip
mov ah,0h
mov cl,10
mul cl
add al,total+1
div bl
Skip:
mov result+1,al

ret
ComputeResult ENDP

display PROC
mov ax,00h
mov al,bl
mov bl,100
div bl
mov cl,al
mov al,ah
mov ah,0h
mov bl,10
div bl
mov bl,ah
mov ch,al
mov dl,cl
add dl,30h
mov ah,02h
cmp dl,30h
JE M
int 21h
M:
mov dl,ch
add dl,30h
; int 21h
mov dl,bl
add dl,30h
int 21h
ret
display ENDP

Explanation of Code:
 Data Segment: (Variable declaration)

New line:
New line variable is used to move the cursor to the next line. Every time we need to move to next line, we
will simply use this variable to move cursor to the next line.
Welcome:
Welcome will display a message that will welcome the user in our calculator.

Thanks:
Thanks is a going away message and will be displayed when user leave the program.

Ask:
Ask is a menu and it has two options whether to continue the grading or exit the program.

Invalid_:
Invalid is a message that will restricts user from entering the wrong input. It will display a message to tell
user that the entered value is invalid.

Subject:
Subject will ask user to enter the number of subjects for which he wants to calculate the GPA.

Grade:
Grade will store the grade in the corresponding subject for GPA calculation.

Invalid G:
Invalid G will restricts user from entering wrong grades accidently or intentionally. For example, grade
cannot be P, O, X, Z. Whenever user enters wrong grade, it will display a message that will tell user that the
entered grade is incorrect.

Invalid:
Invalid will restrict user from entering wrong credit hours.

Credit hour:
Credit hour will store the number of credit hours for the subject.

Show:
Show will display the final GPA of the semester.

I:
I is an index variable that is used to control number of iterations.

Total:
Total contains total number of credit hours calculated using sum procedure.

Tch:
Tch means total credit hours. This variable stores the total credit hours for the respective subjects.

Result:
Result will store the final GPA of a student.

 Main Procedure
Welcome message:

Welcome message is displayed using these two codes of lines. Lea is used because of string. After execution of first 
line, displayString procedure is called which will print the string on the screen. 

Enter Subjects message:

The variable ‘i’ is an index variable. It is used as a counter. These lines of codes will print a message that will ask user 
to enter the number of subjects in the semester. 

Taking Number of Subjects:

It will take the number of subjects for which GPA has to be calculated. It will compare the number of subjects with 0 
and 9 because the number of subjects cannot be 0 or less than 0 or greater than 9. If a user enters a value that will 
violate restrictions, control will be transferred to the label not_valid and in that procedure a message will be 
displayed that will tell user that the input is not valid. 
Taking grades of subjects:

These lines of code take grades of subject. ‘I’ is an index variable. It will hold the record of number of subjects and 
restricts user to enter only the grades for number of subjects which are total number of subjects. With each subject 
grade, it will take credit hours for the subject as it is required for the calculation of grades. It will call the procedure 
‘displayString’ for displaying the message to enter the grade of a subject and it will display a message to enter credit 
hours of subject.  

Taking credit hours:

   

This label will take the credit hours of a subject and if they are beyond the limit, displays a message that invalid 
credit hours. And after that it will return control to the lable take C to again take the credit hours. 

Adding all credit hours:

These codes of lines add the credit hour of subject to total credit hours of all subjects. After that it will move the 
result to another register. Then calls the procedure multiply and sum. 

Next iteration:

It will compare the counter variable I with the value stored in cl and moves to NEXT if they are not equal. After that it 
will call the procedure Compute Result 

Displaying result:
 

This code will print the final GPA of a student. It will display an integer, then decimal point and another integer. After 
that it will jump to ask Again to ask the user whether he wants to calculate another GPA or exit. 

notValid:

It is a label and will prompts user that he/she enters a wrong value and will jump the control to label C and at that 
label it will again take value from user. 

Not_Valid:

It will restrict user from entering invalid subjects. If the user enters wrong value it will tell user that the value is 
invalid. And moves control to label take S. And at that label it will ask user to enter again. 

Askforagain:

It will display a message that will ask user to enter a choice number to continue another calculation or to exit. 

Choice:

It will take the user choice, if user wants to continue it will move control to calculations and if the user wants to exit, 
it will move control to exit procedure. 
ExitP:

It will display a thanks message and exit the program. 

 Procedures
displayChr:

Here displaychr is the name of procedure. the same name should be in the top and the bottom, this is used to
check correct closing of procedures. .As PROC stands for procedure. RET instructions is a return instruction
that simply returns the program control from where it is branched out for the procedure execution. The ENDP
instruction ends the procedure.it will send the character in DL to the standard output device console.

displayString:

displayString is the name of procedure. It will end a string of characters to the standard output. DX contains
the offset address of string. The string must be terminated with a ‘$’ sign. 

input:

Input is the name of procedure.This operation accepts a character from the keyboard buffer. If none is
present, waits for keyboard entry. It returns the character in AL. 

compute:

 
Compute is the name of procedure.it will compute gpa corresponding to a grade.if the user enter other than above
grade it will call to invalidGrade.

A:
 

A label is used according to the grade of respective subject. Grades in this category are A, A+, A-. It will
compare the grade of a subject with respective grades. If grade lies in the category of A, it will perform
operations according to that and increments the total A grades with 1. 

B:

B label is used according to the grade of respective subject. Grades in this category are B, B+, B-. It will
compare the grade of a subject with respective grades. If grade lies in the category of B, it will perform
operations according to that and increments the total B grades with 1. 
C:

C label is used according to the grade of respective subject. Grades in this category are C, C +, C -. It will
compare the grade of a subject with respective grades. If grade lies in the category of C, it will perform
operations according to that and increments the total C grades with 1. 

D:

D label is used according to the grade of respective subject. Grades in this category are D, D +, D -. It will
compare the grade of a subject with respective grades. If grade lies in the category of D, it will perform
operations according to that and increments the total D grades with 1. 

F:

F label is used according to the grade of respective subject. Grades in this category are F-. It will compare
the grade of a subject with respective grades. If grade lies in the category of F, it will perform operations
according to that and increments the total F grades with 1. 
Invalid:

It will restrict user from entering invalid grades. If the user enters the wrong grade, it will tell user that the grade is 
invalid. And moves control to up using jump statement. And at that label it will ask user to enter again. 

multiply:

It will multiply subject's GPA with credit hours and then compare, if it is equal than it will jump to exit label
to end program.

Sum:

It will sum GPA of all subjects to total.it will jump to exit label if the compare result is equal.
ComputeResult:

It will divide the total GPA with total number of credit hours to compute final GPA. if the compare result is
equal then it will jump to skip label. 

Display:

Display is the name of procedure. It will display three numbers which is the GPA. 
Conclusion:
Assembly language is very important for understanding the computer architecture and for programming. The
programmer mainly used many other programming languages for application development and software, but
assembly language is also important it helps the programmer to achieve a lot if they implement the assembly
language. Assemblers contain a lot of metadata that is version number, localization details and other product
details. It is an important part and provided to the user after digitally signed if an individual wants to know
how the system works and the processor as well then assembly language is the one that solves the purpose
it helps in all aspects the algorithm of the program to process or working and registering the registers of the
computer it depends on individual choice with a language to continue. So that is why we solved the grading
problem of students by using GPA Calculator and Grading System. We can calculate the GPA of any
semester with this program. At the start it asks for the total number of subjects in semester and ask for the
grades as well as credit hours of each subject. Then it calculates the GPA using different calculation procedures
and labels. It multiplies grades with credit hour of the subject and add the result to total and then it give the
result in grades by solving all procedures. This program very helpful for the Grade calculations in Schools,
colleges and universities.

You might also like