Sum the array values

In reply to kddholak:

Sorry,as i am new to SV,i don’t know how to proceed,I don’t know how to display the array and result

Plz find my code below and help me to work it out

module eg;
class A;
typedef struct {
int english,maths,science;
string name;
} mark_t;
mark_t sheet ;
mark_t q[]; mark_t result[];

task process_stuct_data();
sheet = '{50,60,80,“john”};
q.push_back(sheet);
sheet = '{60,70,50,“peter”};
q.push_back(sheet);
sheet = '{70,60,90,“nathan”};
q.push_back(sheet);
$display(“value=%p”,sheet);

  result = q.find with ( item.english >= 60 && item.maths >= 60);

$display(“value=%p”,result);

endtask 

A a1 = new ;
A a1=sheet;
foreach(a1.A[i])
$display(“%b”,a1.A[i]);`
endmodule