Program 6: Structured Grades
Program due: Wednesday, May 7th, 11:59 p.m.
Special note about the due date:
This assignment is due on the last day of classes. Per university policy, all work other than final exams is to be completed on the last day of classes. Therefore, you will not be able to use late days on this program.
Program Description:
The program uses an array of structs containing grades for students. Each struct will contain grades for 10 assignments, and an Average. Each grade will consist of the name of an assignment and the grade associated with that assignment. Here is an example student:
mainStudent01:
.asciiz "Quiz "
.half 40
.asciiz "Quiz "
.half 58
.asciiz "Quiz "
.half 55
.asciiz "Program "
.half 100
.asciiz "Program "
.half 100
.asciiz "Program "
.half 100
.asciiz "Program "
.half 100
.asciiz "Program "
.half 100
.asciiz "Homework"
.half 47
.asciiz "Homework"
.half 62
.asciiz "Average "
.float 94.83
Each assignment name will be a nul-terminated string. Each string will contain 8 characters plus the nul character.
You will write two procedures: printStudent and items.
The printStudent procedure will be given one argument in $a0: the address of the start of the struct for a student. The procedure will print the information for the student as shown below (using the student struct shown above):
Average 94.83000183
1. Quiz 40
2. Quiz 58
3. Quiz 55
4. Program 100
5. Program 100
6. Program 100
7. Program 100
8. Program 100
9. Homework 47
10. Homework 62
Notes:
•The 94.83000183 shown above is correct. The “183” on the end is an artifact of how floating point numbers are stored (remember?).
•There is a blank line after the last grade.
•There is a blank space at the start of the numbered lines, except for the last line.
The items procedure will be given two arguments. The first argument, in $a0, will be the address of the start of a student struct. The second argument, in $a1, will be an integer. This integer will be a value between 1 and 10.
The items procedure will print all the grades for the student where the assignment name matches the name in the position indicated by the 2nd argument. For example, consider the following student struct:
mainStudent02:
.asciiz "Quiz "
.half 50
.asciiz "Quiz "
.half 60
.asciiz "Quiz "
.half 50
.asciiz "Program "
.half 55
.asciiz "Quiz "
.half 45
.asciiz "Homework"
.half 50
.asciiz "Quiz "
.half 60
.asciiz "Homework"
.half 50
.asciiz "Homework"
.half 40
.asciiz "Quiz "
.half 42
.asciiz "Average "
.float 82.29
If items is called with the address of the above student struct, and the value 3 as the index, the following will be printed:
1. Quiz 50
2. Quiz 60
3. Quiz 50
4. Quiz 45
5. Quiz 60
6. Quiz 42
Count of items found: 6
Since these six items match the assignment name for the 3rd assignment name. The items procedure will print a count of items found at the end of the list of matches, and will print a blank line.
To help in determining which items match the requested item, we will provide a function named strcmp. strcmp will take two arguments in $a0 and $a1. Each argument will the address of the first character of an assignment name. strcmp will return in $v0 a 1 if the two strings are identical, and a 0 in $v0 otherwise. You are required to use the provided strcmp function in your solution.
Test cases:
We will provide some sample files for you to copy. They will be available to copy on the Unix machines (lectura and the Fedora machines, fd01 to fd08). They will also be on the Windows machines. On the Windows systems, look in the shared Rotis drive: Rotis->csc252->shared->prog6. On the Unix machines, look in the directory: ~cs252/spring08/prog6. In both cases, the files will be named: test01.s, test02.s, etc. Secure ftp can also be used to access the test cases on lectura from your home system. Please check with us if you have problems accessing these test cases.
At the time this handout was written, eight test cases are available. Test cases 1 to 3 test the printStudent procedure. Test cases 4 to 8 test the items procedure.
What will be provided:
Each test case will contain main and strcmp. Each test case will contain an array containing 1 or more student structs. Each student struct is guaranteed to follow the format described.
Required comment:
Your program must have the comment:
# Your code goes below this line
Everything that you provide must go below this required comment line. This includes all comments that you put in, all .text code segments that you add, and any .data segments that you might need.
Label naming conventions:
Labels in MIPS programs are global. This presents a problem when you want to use a label that is already in use elsewhere in the program. To avoid conflicts in labels between your code and the test cases, we will adopt the following practice:
Labels will have the name of the procedure or function at the start of the label. For example, if I want to use the label LoopBegin: in strcmp, then I will name the label strcmpLoopBegin:. If you also want to use the label LoopBegin: in your items procedure, you will name it itemsLoopBegin:.
We will check that you are following these labeling conventions when we grade your program!
Turnin:
Note: We are asking for submission of programs via D2L only.
•Name your program: prog6.s
-
•Login using the “UA NetID Login” (upper-left corner of the web page).
•You should now be at “My Home” on D2L. At the center bottom of the screen, under the heading “My Academic Courses”, you should find “C SC252 SP08 001-002H Homer” listed under 2008 Spring. Click on this link.
•You will now be at the CSc 252 page for Spring 08.
•There is a row of links just underneath the Wildcat. In this row, you will find the link “Dropbox”. Click on this link.
•You will be at a page that shows two Dropbox Folders: Program6, Program6-Regrade. Only one of these will be active. The Program6 folder is for on-time submissions. The Program6-Regrade folder is used for requesting a re-grade of the program after the grades have been returned. Click on “Program6”.
•You should now be at the page: “Submit Files - Program6”. Click on the “Add a File” button. A pop-up window will appear. Click on the “Choose File” button. Use the file browser that will appear to select your prog6.s file. Click on the “Upload” button in the lower-right corner of the pop-up window.
•You are now back at the “Submit Files - Program6”. Click on “Upload” in the lower-right of this window. You should now be at the “File Upload Results” page, and should see the message File Submission Successful.
•You can repeat this process as often as necessary. Each submission will be time-stamped. When we grade programs, we will grade only the most recent submission.