Lesson 4: Java Program Control Flow
Activity #1: Get three exam grades from the user and compute the average of the grades.
Output the average of the three exams. Together with the average, also include a smiley face
in the output if the average is greater than or equal to 60, otherwise output :-(.
1. Use Scanner class to get input from the user, and System.out to output the result.
2. Use JOptionPane to get input from the user and to output the result.
Activity #2: Get a number as input from the user and output the equivalent of the number in
words. The number inputted should range from 1-10. If the user inputs a number that is not in the
range, output, "Invalid number".
1. Use an if-else statement to solve this problem.
2. Use a switch statement to solve this problem
Activity #3: Create a program that prints your name a hundred times. Do three versions of this
program using a while loop, a do-while loop and a for-loop.
While Loop
Do-While Loop
For Loop
Activity #4: Compute the power of a number given the base and exponent. Do three versions
of this program using a while loop, a do-while loop and a for-loop.
While Loop
Do-while Loop
For Loop
GROUP 6 MEMBERS:
Bibon, Sofia Mae
Callope, Van Allen
Ortega, Jonaliza S.
Palma, Renz Norman R.
Rompe, Clarissa R.