Computer Science 220 Weighted Average

$25.00

Category: You will Instantly receive a download link for .zip solution file upon Payment || To Order Original Work Click Custom Order?

Description

5/5 - (4 votes)

Learning objectives:

  • Develop a Python program that uses numeric data from a text file.
  • Accumulations

Assignment:

A professor at Hardtack University has an unusual method of grading. The students may or may not all take the same number of tests. The individual tests are weighted, and these weights are used to compute the student’s average. Important: the weights for all of the tests for a given student must add to 100. Assuming that w1 … wn are the weights, and g1 … gn are the grades, the average is computed by the formula:

 

((w1 * g1) + (w2 * g2) + … + (wn * gn)) / 100

 

The names of the students and their grades, with weights, are stored in a text file in the format firstName lastName w1 g1 w2 g2 … wn gn

 

Write the program weightedAverage.py. Ask the user to enter the name of a file of grades. Compute and print each student’s average, using the formula given above. Then compute and print the class average, an average of the individual averages. Format all averages to one decimal place.  Note the weights for each student will always add up to 100.

 

For example, if the text file contains:

 

Billy Bother 20 89 30 94 50 82

Hermione Heffalump 40 93 60 97

Kurt Kidd 20 88 30 82 40 76 10 99

 

Then the output might look like this:

 

Billy Bother’s average: 87.0

Hermione Heffalump’s average: 95.4

Kurt Kidd’s average: 82.5

 

Class average: 88.3

 

Submission:

Submit weightedAverage.py to your class account.

 

Policies:

The policies given in Program 1 are in effect for this and all assignments. Do not forget to include your name and the Certification of Authenticity.