Question
Hello I need help with a question: The purpose of this assignment is to use parallel arrays. Parallel arrays consist of two or more arrays
Hello I need help with a question:
The purpose of this assignment is to use parallel arrays. Parallel arrays consist of two or more arrays that have a direct relationship between equivalent elements. That is, element 0 in the first array relates directly to element 0 in the parallel array, element 1 in the first array relates directly to element 1 in the parallel array and so on. In this assignment one array will contain letter grades and the other array will contain the numeric grades associated with each letter grade.
Program Requirements
Create and initialize an array containing the following letter grades: A, B, C, D, and F. Create and initialize another array containing the following numeric grades: 90, 80, 70, 60, 0. You should only have these two arrays for your program.
Prompt the user to enter a student's numeric grade from 0 to 100. Read the student grade from the keyboard. You can assume only whole positive numbers from 0 to 100 will be entered by the user.
Prompt the user to enter in a curve amount. Read the curve amount from the keyboard. You can assume only a positive value less than or equal to 30 will be entered by the user.
Use a single for loop to find the letter grade for the student grade input based on the numeric grades array and the curve. You will need to search the numeric grades array until you find the correct letter grade taking into account the curve. The table below shows the mapping of the letter grade to a numeric grade when the curve is 0.
Numeric Grade | Letter Grade |
---|---|
90 to 100 | A |
80 to 89 | B |
70 to 79 | C |
60 to 69 | D |
0 to 59 | F |
You cannot use a series of if/else statements as was done in Assignment 2. You must use a single for loop to search the array and within the loop you can use exactly one if or exactly one if...else if statement.
Print the letter grade the student has received. After printing the letter grade for one student, ask the user if he/she wants to continue. If lowercase or uppercase Y is typed in, allow the user to repeat the process. If not, stop the application. Make sure your output format matches the sample output.
Suggestion: Try to code this assignment first without a curve (or a curve of 0) then add in the code to compute the letter grade based on the numeric grades array with the curve.
Do not use any global variables except symbolic constants.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started