|
|
|
|
|
|
|
5. Your history professor has so many students in her class that she has trouble determining how well the class does on exams. She has discovered that you are a computer whiz and has asked you to write a program to perform some simple statistical analyses on exam scores. Your program must work for any class size up to 100 (0 < N< 100). Write and test a computer program that does the following: |
|
|
|
 |
|
|
|
|
a. Reads the test grades from file inData. |
|
|
|
 |
|
|
|
|
b. Calculates the class mean, standard deviation (defined in Programming Problem 3), and percentage of the test scores falling in the ranges <10, 10-19, 20-29, 30-39, ... , 80-89, and >90. |
|
|
|
 |
|
|
|
|
c. Prints a summary showing the mean and the standard deviation, as well as a histogram showing the percentage distribution of test scores. |
|
|
|
 |
|
|
|
|
Input: |
|
|
|
 |
|
|
|
|
The first data line contains the number of exams to be analyzed and a title for the report. |
|
|
|
 |
|
|
|
|
The remaining lines have ten test scores on each line until the last, and one to ten scores on the last. The scores are all integers. |
|
|
|
 |
|
|
|
|
Output: |
|
|
|
 |
|
|
|
|
The input data as they are read. |
|
|
|
 |
|
|
|
|
A report consisting of the title that was read from data, the number of scores, the mean, the standard deviation (all clearly labeled), and the histogram. |
|
|
|
|
|
|
|
|
6. A small postal system ships packages within your state. Acceptance of parcels is subject to the following constraints: |
|
|
|
 |
|
|
|
|
a. Parcels are not to exceed a weight of 50 pounds. |
|
|
|
 |
|
|
|
|
b. Parcels are not to exceed 3 feet in length, width, or depth, and may not have a combined length and girth exceeding 6 feet. (The girth of a package is the circumference of the package around its two smallest sides; the mathematical formula is |
|
|
|
 |
|
|
|
|
girth=2*(s1+s2+s3-largest) |
|
|
|
 |
|
|
|
|
where largest is the largest of the three parcel dimensions, s1, s2, and s3.) |
|
|
|
 |
|
|
|
|
Your program should process a transaction file containing one entry for each box mailed during the week. Each entry contains a transaction number, followed by the weight of the box and its dimensions (the dimensions can be in any order). The program should print the transaction number, weight, and postal charge for all accepted packages, and the transaction number and weight for all rejected packages. At the end of the report, the program must print the number of packages processed and the number rejected. |
|
|
|
 |
|
|
|
|
Input: |
|
|
|
 |
|
|
|
|
Parcel post table-weight and cost (contains 25 pairs of values). This table should be stored in two one-dimensional arrays. You can determine the postal cost of each parcel by first searching the weight array and then using the corresponding element in the cost array. If a package weight falls between weight categories in the table, your program should use the cost for the higher weight. |
|
|
|
 |
|
|
|
|
Transaction file-transaction number, weight, and three dimensions for an arbitrary number of transactions. Assume that all weights are whole numbers, and that all dimensions are given to the nearest inch. |
|
|
|
|
|