U.Smith U.Smith - 1 month ago 15
Java Question

Java Define char Instance Variable

I am currently doing exam revision questions for Intro to Programming and I came across this question.


Define a char instance variable academicLevel to store the academic level for the employee. The possible values for academic levels are in the range A—E (A=associate lecturer, B=lecturer, C=senior lecturer, D=associate professor, E=professor).


And I'm not exactly sure how it wants me to 'define'. Just like this?

private char academicLevel;

Answer

I believe it is asking you to define a char instance, just like you did, and then implement some code (ie : a switch) to filter the possible values