Question: c + + , writing a program that stores a list of scores and the corresponding letter grades in two parallel arrays. The scores will

c++,writing a program that stores a list of scores and the corresponding letter grades in two parallel arrays. The scores will be double data type and the letter grade will be a char data type.
**
Welcome to my Parallel Arrays program!
Please enter the list of scores (-1 to end input:)
Valid scores are between 0 and 4 inclusive.
>>3.5
>>2.7
>>3.3
>>2.5
>>3.2
>>1.5
>>4.0
>>3.7
Your stats are as below:
The list of scores and their grades are:
3.5 A
2.7 C
3.3 B
2.5 C
3.2 B
1.5 D
4.0 A
3.7 A
The list sorted by scores in ascending order:
1.5 D
2.5 C
2.7 C
3.2 B
3.3 B
3.5 A
3.7 A
4.0 A
The median score is 3.25
Thank you for using my Parallel Arrays program!!
Welcome to my Parallel Arrays program!
Please enter the list of scores (-1 to end input:)
Valid scores are between 0 and 4 inclusive.
>>3.5
>>2.7
>>3.3
>>4.5
Invalid score! Please try again!!
>> abc
Invalid score! Please try again!!
>>3.2
>>1.5
>>4.0
>>3.7
>>4.0
Your stats are as below:
The list of scores and their grades are:
3.5 A
2.7 C
3.3 B
3.2 B
1.5 D
4.0 A
3.7 A
4.0 A
The list sorted by scores in ascending order:
1.5 D
2.7 C
3.2 B
3.3 B
3.5 A
3.7 A
4.0 A
4.0 A
The median score is 3.40
Thank you for using my Parallel Arrays program!!
** program requirement , thanks for your help
first read the numerical scores from the user as input into a double array, and then calculate the letter grade and fill another parallel array and print the two arrays as output.
The numerical score must be between 0 and 4 inclusive. The user should not be allowed to enter a score less than 0 or greater than 4.
You will also sort the arrays based on the scores, and calculate the median of the scores and output the sorted arrays and the median in main().
Write the following functions and call them in the same order as instructed in the main() function to accomplish this Task.
void welcome()- This function prints a welcome message to the user.
void readScores(double scores[], int &count)
Reads a list of scores from the user. A -1 indicates the end of the input and is not stored in the array. (Use an appropriate loop!! Check out this example code - a for loop is count controlled, and a while loop is condition based.)
Call the readDouble function to do this. You must catch all invalid data such as characters, negative numbers other than -1 etc.
The variable count keeps track of the number of scores entered.
You must also do validation to make sure that the number is between 0 and 4 inclusive and nothing other than that. Use a while loop to do this.
void readDouble(string prompt, double &num)
This function should be used any time you read any floats or doubles from the user. Use this function to read the numerical scores from the user.
It takes a string prompt, outputs it, reads a number from the user, validates and returns the num by reference.
Write it exactly like the readInt from assignment 1 but declare a double or float instead of an int. See Samplea01.cpp for the readInt function.
You must catch all invalid data such as characters, negative numbers etc.
void calcGrade(double scores[], char grade[], int count)
Use a loop to process each array element and calculate the letter grade for each score.
Letter Grade
4.0 Score
Level
A
>3.3<=4.0
Exceeds
B
>2.7<=3.3
Meets
C
>1.9<=2.7
Approaching
D
>1.1<=1.9
Not Yet
F
>0.0<=1.1
No Evidence
void printList(double scores[], char grades[], int count)
Go through a for loop and print the scores and the corresponding grades for each item.
void sort(double scores[], char grade[], int count)
Sort the arrays using the given sorting algorithm.
double median(double scores[], int count)(***new to this level***)
After sorting, write this function to identify the median score. The median is located in the middle of the array if the arrays size is odd. Otherwise, the median is the average of the middle two values.
Return the median to main() and output in main() with two decimal places.
int main()
Declare all variables needed. The 2 arrays (double scores[], and char grades[]) must be declared in main().
Call readScores() and send scores and count to it. This will fill the scores array from the user. You should call the readDouble() function to read and validate the scores before adding them to the scores array.
count will have the number of values read.
Call calcGrade()function that takes the scores array and an empty grades array and fills the grades array with letter grades.
Call the printList function to print the lists.
Call the sort function to sort the list based on scores.
Call the printList function to print the lists.
Call the median function to find the median and print it in main().
Assume the arrays will always contain fewer than 20 values. You must not let the user enter more than 20 values.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!