0% found this document useful (0 votes)
46 views4 pages

Java Control Flow Programming Activities

This document outlines 4 activities to demonstrate Java program control flow. The activities include: 1) calculating the average of 3 exam grades and outputting a smiley or frown based on the average, 2) getting a number input and outputting the word equivalent from 1-10, 3) printing a name 100 times using different loops, and 4) computing a number to a power using different loops. The activities are meant to be completed using various input/output methods and looping structures like while, do-while, and for loops. The document also lists the group members who will work on the activities.

Uploaded by

Sofia Mae Bibon
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
46 views4 pages

Java Control Flow Programming Activities

This document outlines 4 activities to demonstrate Java program control flow. The activities include: 1) calculating the average of 3 exam grades and outputting a smiley or frown based on the average, 2) getting a number input and outputting the word equivalent from 1-10, 3) printing a name 100 times using different loops, and 4) computing a number to a power using different loops. The activities are meant to be completed using various input/output methods and looping structures like while, do-while, and for loops. The document also lists the group members who will work on the activities.

Uploaded by

Sofia Mae Bibon
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

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 [Link] 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.

You might also like