Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Lab02 - Data Analysis Problem The purpose of this lab is to introduce more compl

ID: 3743606 • Letter: L

Question

Lab02 - Data Analysis Problem The purpose of this lab is to introduce more complex data manipulation using assembly language. You will be exploring concepts relating to data storage and looping structures while analyzing a random set of grade values. Your program will calculate the minimum and maximum grades along with the average and median grades of the set. Assignment Create a project that will allow you to enter a random set of grades and provide storage for the results in RAM. Use meaningful names for your RAM storage locations to help make your code more readable. You should provide locations for your grade data, minimum grade, maximum grade, average grade, and median grade. Allowed grades are between 0-100. You will indicate the end of the grade set with a value of -1

Explanation / Answer

Your questions breaks down into:
Step1: Assuming that initially there are 10 people in the course with maximum marks being
       100 and minimum being 0.
Step2: The data here is the allowed grade which is between 0 to 100.
Step3: The last value is set to -1 to indicate the end of array.
Step4: You have to iterate over every grade, and find maximum, minimum, sum(for mean)
       and median will be the middle point of array.
      
For your convinience, I have written this sample code for you.
This code counts the number of A grade in the data given.
Here, you can see the data is given as pair of student id and grade.
cnt1 stores the count of students.
The data for student id and grade can be stored in dat1.
The Assembly program does these things:
1. Stores the count of A grades in acnt1
2. Stores the id of student who have scored A grade in res1 array.

Here is the code:

.model tiny
.data                            
dat1    db      '238','A', '246','B', '278', 'C', '101', 'A', '108', 'C'
        db      '233','E', '111','B', '210', 'D', '002', 'C', '010', 'A'
cnt1    dw      0ah
acnt1   dw      0
res1    db      30 dup(0)
.code
.startup
        lea     di,res1
        lea     si,dat1
x3:     mov     cx,3
        mov     al,[SI+3]
        cmp     al,'A'
        jne     x1
    rep movsb
        inc     acnt1
        jmp     x2
x1:     add     si,3
x2:     inc     si
        dec     cnt1
        jnz     x3
.exit
end

Now, for your question:
You should follow these steps:
1. Make a data array for some students storing the grades
2. Iterate over the array as I have done to find max and min
3. To find average, find the sum of grades and later divide by number of students.
4. To find median, take the middle point of data array

Note: While iterating, you have to stop where you encounter -1 as array point. This is end
point of data.