Programming problem: This program is simply an improvement over Assignment. This better version will also consider whether or not the size read in from the file is VALID.
The program will keep track of total number, good, bad, & valid diameters. The program will ONLY STOP once the end of the file is found. Like #8, a ball bearing is classified as faulty if its diameter is less than 1.96 mm or greater than 2.04 mm.
The program will also keep track of the average bearing diameter.
Program summary:
1. Reads data from a file until the end of the file is found.
2. Reports the size and number of the bearing read in for each bearing value in the file.
3. Reports the number of valid, invalid, good, bad, and total bearings after reading in each bearing size (e.g. within the loop). ALSO reports the average diameter of the VALID bearings examined.
4. After the end of the file is found (e.g. loop stops / stops reading in sizes):
a. Reports the total number of bearings, the number of valid bearings, the number of invalid bearings, the number of good bearings, the number of bad bearings, and the average bearing diameter (considering only valid bearings) for each iteration.
b. After reading in all of the bearings the program reports:
i. Total number of bearings read.
ii. Total number of valid and invalid bearings read.
iii. Percentage of good ball bearings considering valid sizes only.
iv. Percentage of bad ball bearings considering valid sizes only.
v. Average ball bearing diameter for valid sizes only
5. Note: the 2.0 mm +/- 0.05 mm is NOT the range used for VALIDATION... that is the test for GOOD versus BAD... a larger range will be used for testing validation.
6. The text file will contain a mixture of good (within tolerance), bad (outside of tolerance), AND INVALID sizes (see your answer to Q1). Recall however that the program will only quit when the end of the file is found.
C code with geany software