Enum in a Switch
Statement
Java programming
Directions: Recall your topics on
Switch Statement, create your own
program using enum in a switch
statement with the basis on the next
slide.
enum Level {
LOW,
MEDIUM,
HIGH
}
public class Main {
public static void main(String[] args) {
Level myVar = Level.MEDIUM;
switch(myVar) {
case LOW:
System.out.println("Low level");
break;
case MEDIUM:
System.out.println("Medium level");
break;
case HIGH:
System.out.println("High level");
break;
}
}
}
Rubrics
Points Description
20 The student successfully executes the program without
mistakes.
12
The student successfully executes the program with very
little mistakes.
8
The student successfully executes the program with moderate
mistakes.
5
The student was not able to completely execute the program
but details and layout of the drawing.
2 The student was not able execute the program .

Enum in a Switch Statement learning material.pptx

  • 1.
    Enum in aSwitch Statement Java programming
  • 2.
    Directions: Recall yourtopics on Switch Statement, create your own program using enum in a switch statement with the basis on the next slide.
  • 3.
    enum Level { LOW, MEDIUM, HIGH } publicclass Main { public static void main(String[] args) { Level myVar = Level.MEDIUM; switch(myVar) { case LOW: System.out.println("Low level"); break; case MEDIUM: System.out.println("Medium level"); break; case HIGH: System.out.println("High level"); break; } } }
  • 4.
    Rubrics Points Description 20 Thestudent successfully executes the program without mistakes. 12 The student successfully executes the program with very little mistakes. 8 The student successfully executes the program with moderate mistakes. 5 The student was not able to completely execute the program but details and layout of the drawing. 2 The student was not able execute the program .