I need help with this assignment that I have to do. I am new to C++ programming and I do now know how to start this lab. Here is the instruction to the lab..please help..
COMP-122 Lab 6
• Use an organized, modular approach to develop programs, including appropriate functions and structure (sequence, selection, repetition and nesting).
• Design and implement functions that pass parameter, including arrays, appropriately, i.e., by value, by reference, by pointer, by const reference or by const pointer.
• Use parallel arrays effectively to associate multiple data values for a single entity.
Write a program that asks the user how many students to process, then reads in the scores for two items, an exam score and lab average, for that many students, then calculates and displays a table of the students’ grade information, as follows:
1. An enumerated table with exam scores, lab averages, calculated point grades and letter grades (explained below) for each student (one student per row).
2. Overall exam average.
3. Over lab average.
4. Overall grade percentage average.
Each student’s point grade (percentage) is based on a weighted average, 70% for the exam and 30% for lab average.
Each student’s letter grade is based on his/her point grade:
90 and above: A
At least 80 but less than 90: B
At least 70 but less than 80: C
At least 60 but less than 70: D
Less than 70: F
Problem Analysis: Data Aspect
There are basically three aspects of program that needs to be analyzed and designed, data organization, algorithm (the steps to solve the problem) and user interface.
Arrays are a very convenient way to organize and process data in situations where there are multiple values for a particular item, such as students’ test scores for an exam or other assignment. Analyzing the problem statement above, it should be apparent that there are four such data items:
1. Exam scores: whole number percentages, ranging from 0 to 100.
2. Lab average scores: floating point numbers, ranging from 0.0 to 100.0.
3. Calculated point-grade for each student (the weighted average, 70% for exam and 30% for lab), floating point numbers ranging from 0.0 to 100.0.
4. Letter grades: based on the calculated point-grade as shown in the table below, characters in the set A, B, C, D and F.
Numerical Average Letter Grade
Greater than or equal to 90% A
Greater than or equal to 80% but less than 90% B
Greater than or equal to 70% but less than 80% C
Greater than or equal to 60% but less than 70% D
Less than 60% F
Note that for all four arrays a specific subscript number will refer to the same student, regardless of which array is being used. To visualize this, imagine the four arrays are placed side-by-side (in parallel) to form a two dimensional grid, or table. Each column corresponds to one of the four arrays and the array subscript selects a row that corresponds to one student.
Student Number and Array Index
For a variety of reasons it is easier to write programs that use a number rather than a name to access data associated with a person, so it would be useful to assign each student a Student Number. Rather than create another, separate data item, consider the discussion above, which demonstrates that the same index value used in all four arrays selects all the data items for one student, so is already a unique number associated with each student, the index number. The only problem with the index number is that we prefer to start student numbers with 1 instead of 0, but that is easy to handle in the code: any time a student’s number is required just add one to the index value. If the number of students is n, then the program will be written using subscripts from 0 to n - 1 for Student Numbers 1 to n.
Problem Analysis: Code Organization (Algorithm)
This section discusses the design of the algorithm aspect of the program. An algorithm is nothing more than a sequence of steps that will solve the problem and is easily translated into a program. Algorithms are most commonly described in pseudo-code and describe the code organization, or structure, of the program (using the basic structural elements discussed in class, sequence, selection, repetition, nesting and functions). Good, logical program structure that makes programs easier to read is extremely important in all phases of the code’s life cycle, from development to debugging, final test and maintenance.
A particularly good organization for this exercise is a very common one:
1. Read in all data first (number of students and exam and lab average scores, storing the scores in arrays for later processing).
2. Process the data: Calculate the student point grades and letter grades and store them in arrays for output later.
3. Display the data: both input and calculated grades in a table, plus overall averages for the exam, lab averages and overall average point grades.
With this in mind, your program must perform the steps below, in the order given, and meet the requirements specified.
1. Get number of students: Use a function, getStudentCount, to get the number of students to process from the user.
2. Get the students’ score data: Use two different functions, getExamScores and getLabScores, to read in scores for exams and lab averages. Both of these functions must be passed the student count from step 1.
3. Process the data: Use two different functions, calculatePointGrades and calculateLetterGrades, to calculate the point grades then letter grades, in that order. Just as in step 2, both functions must be passed the student count from step 1. After these functions execute all the data required for the output will be available.
4. Display results: Use a function, showGradeData, to display the table as shown in Figure 1 and the overall averages for exam, lab scores and point scores.
Display all floating point values rounded to one decimal place and be sure to print the headings and align the data as shown in Figure 1. Also, force whole number values for lab average and point scores to display “.0”.
Create and use the functions mentioned above:
1. getStudentCount – asks the user to enter the number of students and returns the value entered.
2. getExamScores – receives the number of students and the name of one-dimensional integer array to store the scores entered by the user. It should include the student number in the prompt to enter each exam score.
3. getLabScores – receives the number of students and the name of one-dimensional array to store the floating point lab average scores entered by the user. It should include the student number in the prompt to enter each score.
4. calculatePointGrades – receives the two arrays of scores (for the exam and lab average), the number of students and the name of a one-dimensional array into which the calculated point grades are to be stored.
5. calculateLetterGrades – receives the point grades array, the number of students, and the name of a one-dimensional array of characters to store the letter grades (as determined by each student’s point grade).
6. showGradeData – receives all four arrays (exam scores, lab averages, point grades and letter grades) and the number of students. It displays the table and other data as shown in Figure 1, below.
7. intArrayAve – returns the average of the values in an int array (receives an int array and the number of values to average).
8. doubleArrayAve – returns the average of the values in a double array (receives a double array and the number of values to average).
1. As stated in the Programming Style Guidelines, you should have a prologue for each function definition that describes its operation, what it receives, what it returns and what it assumes (in addition to the prologue for main).
2. Also, be sure to protect arrays passed to functions if they are read only (make them const in the parameter list of the function declaration and definition).
Test Plan and Data
It should be obvious that it would take a lot of test cases and time to thoroughly test this program. Nevertheless, you are expected to test your code relatively thoroughly, but, in order to keep the report a reasonable length, just include one test case with the data shown in the Figure 1.
Include the following in the order listed and with a heading for each item:
1. Source code.
2. Predicted output table as shown in Figure 1 but with precalculated values.
3. Actual output (copied from the Command Prompt window) for the same inputs as #2.
4. Summary: Write a statement summarizing your predicted and actual output; identify and explain any differences.
5. Conclusions: Write at least one non-trivial paragraph that explains in detail either a significant problem you had and how you solved it, or, if you had no significant problems, something you learned by doing the exercise.
1 100 100.0 xxx.x x
2 95 99.9 xx.x x
3 90 99.9 xx.x x
4 80 88.8 xx.x x
5 70 77.7 xx.x x
6 60 66.6 xx.x x
7 50 55.5 xx.x x
Exam Average: XX.X
Lab Average Average: XX.X
Point Grade Average: XX.X
Figure 1 This is how your output should be formatted. SN (column one’s heading) stands for Student Number, which is the array index + 1.