Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C Program will add the coursework array marks to the exam array marks and store them in the results array. Assume the number of students

C Program will add the coursework array marks to the exam array marks and store them in the results array. Assume the number of students is 12. The program will then increase the marks in the results array if half of the students fail. Note that CURVE is a function called by the main program. Additionally, the program will create counters for the number of students with a result >=70,>=60,>=50 and <50.
Write the equivalent MIPS assembly code for the C-code shown. Remember to add comments to your assembly code. (DONT USE SYSCALL RATHER JAL or JR) Dont worry about setting a feature to only allow total marks to be 100 or marks for coursework or exam to be 50, just assume data should be put in should be less.
//------------
// MAIN PROGRAM
//------------
int a, b, c, f; // Declare results counters
int i;// Declare loop counter
int y; // Declare total number of students
y =12; // Initialize y =12
a=0; b=0; c=0; f=0;// Initialize results counters
int coursework [];// Coursework is an array to store
// the coursework marks that goes
// from 0 to 50.
int exam []; // Exam is an array to store the exam
// marks that goes from 0 to 50.
int results []; // Results is an array to store the
// total marks = coursework + exam. // And the sorted total marks.
// It goes from 0 to 100
for (i=0; i h){
d =??; // d =100 the highest
// mark in your results array
for (i=0; i=70,>=60,>=50 and <50
//----------------------------------------------------------
f =0;
for (i=0; i=70)
a = a +1;
else if(results[i]>=60)
b = b +1;
else if(results[i]>=50)
c = c +1;
else
f = f +1;
}
//----------------------------
// Main program code ends here
//----------------------------
//------------------
// CURVE function code
//------------------
void CURVE (int p[], int z, int k)
{
p[z]= p[z]+ k;
}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions