CPSC 120 LAB 6 Back to Lab index page

Lab must be completed and reviewed by Peer Instructor Seth Peery no later than Wed, Oct 3 during lab class.

You are to write a nicely documented Ada program that will:

The program should repeat this process until all students id numbers and average score have been displayed.

Sample 1

Program outputs: How many students are there in the class?
User inputs: 3
Program outputs: How many assignments have been graded in this class?
User inputs: 2
Program outputs: Enter the id number for student 1>
User inputs: 106
Program outputs: Enter the score for assignment 1>
User inputs: 85
Program outputs: Enter the score for assignment 2>
User inputs: 75
Program outputs: Student Number - 106 Avg = 80.0
   
  Similar input and output for each student in the class.

You will need to use FOR loops to implement this program. The basic sections of the program will be:

Ask the user to input the number of students in the class and store in a variable,ie. nostudents;

Ask the user to input the number of graded assignments so far in the class and store in a variable, ie. noscores;

Implement two nested FOR loops
- the inner loop will ask for the student Id and scores for each student
- the outer loop will ask for the student's ID number

Example of the nested FOR LOOPS using some informal pseudo-code.

FOR count IN 1..nostudents LOOP
    Get student id number
    Totalscores := 0
    FOR num IN 1..noscores LOOP
        Get score
        Totalscores := total scores + score
    End LOOP;

    Avgscore := Totalscores/noscores;
    Put student id number
    Put student avg. score
    New_Line
End LOOP;