Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 2

Grade 12 – Jasmine Date and Time: Feb 5, 2020 2:00-3:00pm

I. Objectives
a. The purpose of the lesson is for learners to learn on how to utilize switch case statement
in creating for some basic and advanced programs
II. Subject Matter
a. Title: Java Program Switch case statement
b. Materials: Java Eclipse Program, Computers, Projector, Projector Screen, PowerPoint
presentation, Office Remote using Smartphone and Computer.

III. Lesson Proper


a. Review: Review on the previous lesson.
b. Motivation: show a program that runs on a switch case statement
c. Lesson Proper: Discussion
i. The teacher will introduce the new topic on the learners.
ii. The learners will be given an idea on how a switch case statement works.
iii. The learners will be given important code terms in order to understand each of
the function of the code.
iv. Learners will be given a running program example with a sample code and will
be given an explanation as to how the program works.
d. Generalization:
i. A programming language uses control statements to cause the flow of execution
to advance and branch based on changes to the state of a program.
ii. The switch statement is Java’s multiway branch statement. It provides an easy

way to dispatch execution to different parts of your code based on the value of
an expression.
iii. This is how it works:
1. The switch expression is evaluated once.
2. The value of the expression is compared with the values of each case.
3. If there is a match, the associated block of code is executed.
4. The break and default keywords are optional.
iv. When Java reaches a break keyword, it breaks out of the switch block.
This will stop the execution of more code and case testing inside the block.
v. The default keyword specifies some code to run if there is no case match

e. Application:
i. Learners will be given a chance to try the switch case statement by giving them
a sample question.
ii. While the learners are practicing and experimenting on the switch case
statement the instructor can circle around the students to give further ideas on
how the learners can use switch statement
IV. Evaluation
Exercise 1: Write a Java program to detect key presses.
a. If the user pressed number keys( from 0 to 9), the program will tell the number that is pressed, 
otherwise, program will show "Not allowed".

Exercise 2: Write a Java program that allows the user to choose the correct answer of a
question.

See the example below:


What is the correct way to declare a variable to store an integer value in Java?
a. int 1x=10;
b. int x=10;
c. float x=10.0f;
d. string x="10";
Enter your choice: c

Invalid choice!!!

V. Assignment:
a. Research on the next topics to be discussed:
1. Java Inheritance
2. Java Enums
b. Write each of this topics

Submitted by:

Edeson John M. Cabanes


Teacher I

Observed by:

______________________
Master Teacher II

You might also like