Question
Create a java class file named SwitchDemo.java. This class should satisfy the following requirements: a. Declare and initialize a character variable with a letter grade.
Create a java class file named SwitchDemo.java. This class should satisfy the following requirements: a. Declare and initialize a character variable with a letter grade.
b. Has nested ifelse statements that performs the following checks: i. If the letter grade is A, a message stating Great work is displayed ii. If the letter grade is B, a message stating Good work is displayed iii. If the letter grade is C, a message stating Average work is displayed iv. If the letter grade is D, a message stating Below average work is displayed v. If the letter grade is F, a message stating Unsatisfactory work is displayed vi. If the letter is anything other than the above values, a message stating that the letter was invalid should be displayed
c. Once the nested ifelse is completed, replicate the functionality using a switch statement instead
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started