Write a switch statement to convert a letter grade into an equivalent numeric value on a four-point scale. Set the value of the variable gradeValue to 4.0 for an A, 3.0 for a B, 2.0 for a C, 1.0 for a D, and 0.0 for an F. For any other letter, set the value to 0.0 and display an error message.
What will be an ideal response?
```
switch(letter){
case 'A':
gradeValue = 4.0;
break;
case 'B':
gradeValue = 3.0;
break;
case 'C':
gradeValue = 2.0;
break;
case 'D':
gradeValue = 1.0;
break;
case 'F':
gradeValue = 0.0;
break;
default:
gradeValue = 0.0;
System.out.println("The grade "
+ letter + " is not valid");
}
```
This code is in Fragments.java.
You might also like to view...
Which tool allows you to create SQL queries to be executed against a database?
A. Object Explorer B. Query Editor C. Analysis Services D. View Compiler
Describe two of the four methods of digital signal modulation.
What will be an ideal response?
________ is an audio type developed by IBM and Microsoft that is supported by Windows and all of the most popular browsers
Fill in the blank(s) with correct word
The statement ____ returns the element at the position index in vector vecList.
A. vecList[index]
B. vecList.get(index)
C. vecList.front(index)
D. vecList