CS 2401 Assignment #1

Due Date: Tuesday, September 7 or Wednesday, September 8, depending on the day of your lab.

Objective: The goal of this assignment is to refresh your memory of 1-dimensional arrays, in preparation for the following lab on multi-dimensional arrays.

Background: To reduce traffic congestion at UTEP, the University decided to install a roundabout at the entrance to UTEP from the freeway. To check how efficient this solution is, the UTEP Transportation Lab asked the students in CS 2401 to collect and analyze the data about the waiting times.

A waiting time of 5 minutes or more is considered bad, and waiting time of 10 minutes or more is unacceptable.

Assignment: Let us assume that each student places his or her information into a file, with each waiting time (in minutes) on a separate line. Your program should read the names of each student file from the command line. It will then read the data from all of the files, put the data into an array, and compute and print the following information:

Example. Assume that the 1st student recorded the times 1.0, 0.6, 6.0, 11.0, and 3.2 minutes. The second student recorded the values 0.7, 0.6, 7.5, 0.9, and 1.3 minutes. In this case, the first input file is as follows:

 1.0
 0.6
 6.0
 11.0
 3.2
and the second input file is:
 0.7
 0.6
 7.5
 0.9
 1.3
The resulting array must contain all these ten values.

In this example, the maximum waiting time is 11.0 minutes. The average waiting time is

 1.0 + 0.6 + 6.0 + 11.0 + 3.2 + 0.7 + 0.6 + 7.5 + 0.9 + 1.3   32.8
 ---------------------------------------------------------- = ---- = 0.328.
                              10                               10
We have 3 bad waiting times (6.0, 11.0, and 7.5) out of 10 and one unacceptable time (11.0) out of ten. Thus, the probability of a bad waiting time is 3/10 = 0.3, and the probability of an unacceptable waiting time is 1/10 = 0.1.

Deliverables: Your TA will instruct you.