posted by Lee on .
Project: I need help getting start on this project. What I have so far is a mess. It's Do While loops and nested loops.
Table 6.1 shows the different grads of eggs and the minimum weight required for each classification. Write a program that processes the text file EGGS.TXT containing a list of the weights of a sample of eggs. The program should report the number of eggs in each grade and the weight of the lightest and heaviest egg in the sample Figure 6.6 shows a possilbe output of the program. Note: Eggs weighting less than 1.5 ounces cannot be sold in supermarkets. * If you need more details let me know.
This is a visual basics project.
I suppose the table shows the minimum weight in oz. for each grade (A,B,C,.. etc.)
This is what I suggest:
1. Read the grade (as string) and minimum weight (as float) into two arrays. Call the number of entries maxGrade.
2. make a third array called gradeCount, with maxGrade as the maximum subscript.
3. Read in the weight of each egg from eggs.txt, and compare with the weight array using a for-loop. If the weight weight exceeds the array value, increment the gradeCount and exit the for-loop.
4. repeat until the entries of eggs.txt is exhausted.
5. output the gradeCount array with the corresponding grades.
Post you code if you have problems.
Thank you I was able to create my program with your suggestions.