Having trouble on solving the following tasks

Looking at the the last full version of your code that you posted you are missing a range check on sensorValue before you use it. The sensor can report a much greater range than your table deals with.

Something like

if (sensorValue >= lowest && sensorValue =< highest ){
// your code to translate the sensorValue
} else {
Serial.print("Error or something");
}

Mark