Create aswitchstatement that will test the value of a variable namedscore. Ifscorehas a value of 5, create aprintlnstatement that will output "Excellent". Ifscorehas a value of 4, create aprintlnstatement that will output "Great". Ifscorehas a value of 3, create aprintlnstatement that will output "Good". Ifscorehas a value of 2, create aprintlnstatement that will output "Fair". Ifscorehas a value of 1, create aprintlnstatement that will output "Needs improvement". Ifscoredoes not contain a matching value for any of thecasestatements, create aprintlnstatement that will output "Retake test".
What will be an ideal response?
switch(score){ case 5: System.out.println("Excellent"); break; case 4: System.out.println("Great"); break; case 3: System.out.println("Good"); break; case 2: System.out.println("Fair"); break; case 1: System.out.println("Needs improvement"); break; default: System.out.println("Retake test");}
You might also like to view...
When an invalid character is encountered in a text argument in a Val function, the Val function notes an error and continues the process.
Answer the following statement true (T) or false (F)
The unified device model ________.
a) enables the kernel to use device classes to determine the bus to which a device is attached b) organizes a systems’ devices, device classes, device drivers and buses hierarchically c) was required to implement Plug and Play d) Both a and c.
PSP scripting components include _______, _______ and ________.
Fill in the blank(s) with the appropriate word(s).
For each of the following, write C++ statements that perform the specified task. Assume that unsigned integers are stored in two bytes and that the starting address of the array is at location 1002500 in memory.
a) Declare an array of type unsigned int called values with five elements, and initialize the elements to the even integers from 2 to 10. Assume that the symbolic constant SIZE has been defined as 5. b) Declare a pointer vPtr that points to an object of type unsigned int. c) Use a for statement to print the elements of array values using array subscript notation. d) Write two separate statements that assign the starting address of array values to pointer variable vPtr. e) Use a for statement to print the elements of array values using pointer/offset notation. f) Use a for statement to print the elements of array values using pointer/offset notation with the array name as the pointer. g) Use a for statement to print the elements of array values by subscripting the pointer to the array. h) Refer to the fifth element of values using array subscript notation, pointer/offset notation with the array name as the pointer, pointer subscript notation and pointer/offset notation. i) What address is referenced by vPtr + 3? What value is stored at that location? j) Assuming that vPtr points to values[ 4 ], what address is referenced by vPtr -= 4? What value is stored at that location?