Asg 2: Average Scores (with min tossed out)

Objectives

Implement a simple score tabulator (as in say a skating competition), where the scores range from 1-10 and there are 4 judges. Write a program that loops through as many competitors as the user wants and asks for 4 scores for each competitor. The program should find and discard the minimum score and output the average score of the remaining three entries (see sample program run).

Assignment

  1. Loop while there are competitors for whom to enter scores.
  2. For each competitor, enter the number of scores requested (e.g., 4).
  3. Loop through the entered scores, and keep track of the minimum (don't forget to initialize the minimum to the maximum at the beginning of each score-counting iteration).
  4. If the average score for any competitor exceeds 9, print out some congratulatory message.

Details

  1. The idea here is to maintain a running sum while at the same time keeping track of the minimum score entered. Then subtract that minimum score from the sum.
  2. For the average, divide by the appropriate denominator.

Example Program Run

For competitor 1 enter 4 scores: 1 1 1 1
Result for competitor 1 is 1.00
Another score? (1=yes, 0=no) 1

For competitor 2 enter 4 scores: 1 2 3 4
Result for competitor 2 is 3.00
Another score? (1=yes, 0=no) 1

For competitor 3 enter 4 scores: 10 10 10 10
Result for competitor 3 is 10.00 Golden raspberry!
Another score? (1=yes, 0=no) 0
	

Supplemental

  1. If you call your source code file main.c here is a Makefile that you can use to try to compile the project:
    CC = gcc
    
    .c.o:
    	$(CC) -c -o $@ $<
    
    all: main
    
    main: main.o
    	$(CC) -o $@ $@.o
    
    main.o: main.c
    
    clean:
    	rm -f *.o
    	rm -rf main
    	
    Note that each line underneath the targets is indented by a tab, not just spaces, this is important!

Turn in

Turn in all of your code, in one tar.gz archive of your asg##/ directory, including:
  1. A README file containing
    1. Course id--section no
    2. Name
    3. Brief solution description (e.g., program design, description of algorithm, etc., however appropriate).
    4. Lessons learned, identified interesting features of your program
    5. Any special usage instructions
  2. Makefile
  3. source code (.h headers and .c source)
  4. object code (do a make clean before tar)

How to hand in

See handin notes

Grading scheme