Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Part 6 - Convert and fill another array In this part, you will fill in the value

ID: 3592614 • Letter: P

Question

Part 6 - Convert and fill another array In this part, you will fill in the values of array b, corresponding to each value in array a. Map the values as follows Ratin 0 -5 -3 Meanin Haven't read it Hated it Didn't like it Ok, neither hot nor cold about it Liked it! Really liked it! Text Not-read Terrible Disliked Average Good Excellent 3 For example, when a is [o, 3, -51, b should be ["Not-read", "Good", "Terrible"] after the function is executed. Use "INVALID" if the value does not match any valid rating void convert (int rating[], string text [1,int size)

Explanation / Answer

void convert(int rating[], string text[], int size) {

for(int i=0; i<size; i++) {

if(rating[i] == 0) {

text[i] = "Not-read";

} else if(rating[i] == 1) {

text[i] = "Average";

} else if(rating[i] == 3) {

text[i] = "Good";

} else if(rating[i] == 5) {

text[i] = "Excellent";

} else if(rating[i] == -3) {

text[i] = "Disliked";

} else if(rating[i] == -5) {

text[i] = "Terrible";

}

}

}