Question: the grade is an integer a nd school is a string . Both variables have been declared and the grade has been initialized to a
the grade is an integer and school is a string. Both variables have been declared and the grade has been initialized to a value greater than or equal to 1:
| If grade is | Set School to: |
| 1, 2, 3, 4, | Primary school |
| 6, 7, 8 | Secondary school |
| 9, 10, 11, 12 | Boarding school |
| >12 | High School |
Given a variable x declared as a double and initialized, show the code to cast and store the value of x into a variable y which is defined as a short. Truncation will occur, which is fine.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
