Activity No.
3 - Simple Java Statements
Course Code: CPET 2L Program: BET-CpET
Course Title: Object-Oriented Programming Date Performed:
Group Name: Date Submitted:
Leader:
Members:
Section: Instructor/Prof.: MINABELLE D. VILLAFUERTE
Due date of Submission: Feb 9-13, 2026
1. Objective:
This activity aims to let student provides a logical solution to the given problem, code using Java, debug
and run the program correctly.
2. Intended Learning Outcomes (ILOs):
At the end of the activity, the student must be able to:
1. Identify a solution to the given problem.
2. Code the solution using Java.
3. Write a Java Program to the given problems. .
Instructions; Submit the .java source code, sample I/O tests and the screenshots of the output.
3. Activities:
PROBLEM SOLVING:
1. Write a Java program that will accept 2 integers from the user and get and print the sum, difference,
product, and quotient.
2. Write a program that will compute for the area of a square and rectangle for a given input of base and
height and sides.
3. Write a program that will give the average of input numbers given by the users.
4. Use string commands that will return a “TRUE” answer after finding an input match in a given set of
strings: Ex. Input: “hello”, “hi”, “happy”.search for the string “ha”. Output: “ha” is found in the word “happy”
.
6. A Palindrome is a word, phrase, or sequence that reads the same backward as forward, e.g., madam or
nurses run. (From Oxford Languages)
Example:
- lol
- civic
- radar
Using this information, create a program that will determine if the word from the user input is a palindrome
word, or not.
7. Write a program that will concatenate 2 or more input words. Example: String 1=”hello”, String
2=”world”, String3=”hi”
Output: String1+string2=”helloworld”, String2+String1=”worldhello”, String3+String1=”hihello”
8. Write a Java program:
1. Print 'Good Day' on screen and your name on a separate line.
Expected Output :
Hello
MINABELLE
2. Exchange the content of 2 variables A and B.
3. Convert an input number and convert to equivalent Binary code using divide and %.
Ex. Input = 5 Output = 101
Input 20 = 10100
4. Convert the binary value to decimal
Ex. 101 = 5
1001= 9
9. Write a program to convert specified days into years, weeks and days.
Note: Ignore leap year.
Test Data :
Number of days : 1329
Expected Output :
Years: 3
Weeks: 33
Days: 3
10. Write a program to read an amount (integer value) and break the amount into the smallest possible
number of bank notes.
Test Data :
Input the amount :P 375
Expected Output:
There are:
3 Note(s) of 100.00
7 Note(s) of 50.00
18 Note(s) of 20.00
37 Note(s) of 10.00
75 Note(s) of 5.00
The softcopy must be submitted in your group folder in Google Drive for record purposes. At
the same time, random checking for the output will be made during our laboratory schedule.