Academic Competition Solution

$30.00

Description

A senior high school is holding a academic competition. Three subjects were tested among one hundred students. The subjects are Mathematics, Science and Literature. The test results have been consolidated into the file, lab11.dat. Five Grand Prizes are to be given out to the highest total score students. In addition, the five students with the highest score in each of the three subjects will also be awarded. However, the recipients of the Grand Prizes are not eligible for the Subject Awards. But, a student can win multiple Subject Awards. Your assignment is to write a C program to process the result file and print out the award winners.

The result file has been made to be self explanatory so the first line explains the contents of each following lines. Thus, there are totally 101 lines in the result file, lab11.dat.

Since we have learned struct last week. This assignment is a good opportunity for you to try out programming using structures. The following structure definition is recommended.

struct STU

{

// structure definition for each students

char fName[15];

// first name

char lName[15];

// last name

double

math,sci,lit;

// test scores

double

total;

// total score

int winTotal;

// for winning

Grand Prize

int winSubj;

// for winning

a Subject Prize

};

struct STU

list[100];

The last two fields, winTotal and winSubj, in the STU structure are optional. You don’t need to include them if you don’t find them to be useful. One global structure variable list, which is a structure array of 100 elements, is also recommended for your programming.

The output format of your program should be as following:

Grand Prize Winners:

  1. xxxxx yyyyy zzz.z

  1. xxxxx yyyyy zzz.z

  1. xxxxx yyyyy zzz.z

  1. xxxxx yyyyy zzz.z

  1. xxxxx yyyyy zzz.z

Math Prize Winners:

  1. xxxxx yyyyy zz.z

  1. xxxxx yyyyy zz.z

  1. xxxxx yyyyy zz

  1. xxxxx yyyyy zz.z

  1. xxxxx yyyyy zz.z

1

Science Prize Winners:

  1. xxxxx yyyyy zz.z

  1. xxxxx yyyyy zz.z

  1. xxxxx yyyyy zz.z

  1. xxxxx yyyyy zz.z

  1. xxxxx yyyyy zz.z

Literature Prize Winners:

  1. xxxxx yyyyy zz.z

  1. xxxxx yyyyy zz.z

  1. xxxxx yyyyy zz

  1. xxxxx yyyyy zz

  1. xxxxx yyyyy zz.z

where xxxxx is the first name, yyyy is the last name, and zz.z is the score, either total score or subject score depends on the award category.

Notes.

  1. Create a directory lab11 and use it as the working directory.

  1. Name your program source file lab11.c.

  1. The first few lines of your program should be comments as the following.

/* EE231002 Lab11. Academic Competition ID, Name

Date:

*/

  1. After you finish verifying your program, you can submit your source code by

$ ee231002/bin/submit lab11 lab11.c

If you see a ”submitted successfully” message, then you are done. In case you want to check which file and at what time you submitted your labs, you can type in the following command:

$ ee231002/bin/subrec lab11

It will show the submission records of lab11.

  1. You should try to write the program as efficient as possible. The format of your program should be compact and easy to understand. These are part of the grading criteria.

2