96.6k views
4 votes
PROGRAM 8: Grade Converter! For this program, I would like you to create a function which returns a character value based on a floating point value as

1 Answer

6 votes

Answer:

This function will return a character grade for every floating-point grade for every student in the class.

function grade( floatPoint ){

let text;

switch ( floatPoint ) {

case floatPoint < 40.0 :

text= " F ";

break;

case floatPoint == 40.0 :

text= " P ";

break;

case floatPoint > 40.0 && floatPoint <= 50.0 :

text= " C ";

break;

case floatPoint > 50.0 && floatPoint < 70.0 :

text= " B ";

break;

case floatPoint >=70.0 && floatPoint <= 100.0 :

text= " C ";

break;

default :

text= "Floating point must be between 0.0 to 100.0"

}

return text;

}

Step-by-step explanation:

This javascript function would return a character grade for floating-point numbers within the range of 0.0 to 100.0.

User Hapeki
by
4.3k points