Answer to Question #102384 in Visual Basic for Jeremiah

Question #102384
Five hundred students applied for admission in a university. Each student supplied the result for 8 subjects. Write an algorithm to find the aggregate score for 6 best subjects for each student
1
Expert's answer
2020-02-06T07:51:44-0500
AggregateScores(all_scores[500][8])
    num_studs = 500
    num_subjs = 8
    Let aggregates[num_studs] is another array
    for i = 1 to num_studs
        smallest = all_scores[i][1]
        second = all_scores[i][2]
        if smallest > second
            swap(smallest, second)
        total = smallest + second
        for j = 3 to num_subjs
            score = all_scores[i][j]
            total += score
            if score < second
                if score < smallest:
                    second = smallest
                    smallest = score
                else:
                    second = score
        aggregates[i] = total - smallest - second
    return aggregates
    

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS