Professional Documents
Culture Documents
Teachers College
LET’S FOCUS!
In the next two weeks, you will better understand the concept and application of Java
programming. Through the lessons and activities here, you are expected to:
1. Identify and convert decimal numbers to octal numbers and vice versa; and
2. Write code that declares, and implements Java Method Parameters.
LET’S PREPARE!
By the end of this lesson, you are expected to create a program that will display your skill in
using Java Method Parameters and converting decimal to octal numbers. Pay attention to the following
reminders and criteria.
DIRECTIONS CRITERIA
Use the provided space at the end of this 21 - 30 points
module for writing your code. The program satisfies the specification completely
The program should produce an output that and correctly, with understandable code; and
contains the following information: concise, well - formatted comments. 11 - 20
Last Name points
First Name Some parts of the specification are not
Middle Name implemented; codes are difficult to follow in one
Theprogrammustusea variable appropriate for reading; and partial or poorly formatted
each information. comments.
Write a comment that will explain the use of 1 - 10 points
each variable. The program does not satisfy specification with
incomprehensive code, and wordy, badly
formatted comments.
LET’S EXPERIENCE!
The following work will schedule will help you in your study for two weeks:
1
Sharpen Your Life Cluster
Grade 10, Third Quarter, Module 2, SY 2020-2021
TASK 1: FIND THAT REMAINDER
1 418 / 8 52 2
2 220 / 8 27 4
3 232 / 8 29 0
4 144 / 8 18 0
5 254 / 8 31 6
6 367 / 8 45 7
7 474 / 8 59 2
8 683 / 8 85 3
9 298 / 8 37 2
10 603 / 8 75 3
READING 1: OCTAL NUMBERS
The octal numeral system, or oct for short, is the base-8 number system, and uses the digits 0 to
7. Octal numerals can be made from binary numerals by grouping consecutive binary digits into groups of
three (starting from the right). For example, the binary representation for decimal 74 is 1001010. Two
zeroes can be added at the left: (00)1 001 010, corresponding to the octal digits 1 1 2, yielding the octal
representation
112.
● In the decimal system each decimal place is a power of ten. For example: 7410 = 7 x 101 +
4 x 100
● In the octal system each place is a power of eight. For example: 1128 = 1 x 82
+ 1 x 81 + 2 x 80
1128 = (1 x 64) + (1 x 8) + (2 x 1)
1128 = 64 + 8 + 2
1128 = 7410
● By performing the calculation above in the familiar decimal system, we see why 112 in octal is
equal to 64+8+2 = 74 in decimal.
To convert integer decimals to octal, divide the original number by the largest possible power of
8 and divide the remainders by successively smaller powers of 8 until the power is 1. The octal
representation is formed by the quotients, written in the order generated by the algorithm. For example, to
convert 12510 to octal:
125 = 82 × 1 + 61
61 = 81 × 7 + 5
5 = 80 × 5 + 0
Therefore, 12510 = 1758.
Another example:
900 = 83 × 1 + 388
388 = 82 × 6 + 4
4 = 81 × 0 + 4
4 = 80 × 4 + 0
Therefore, 90010 = 16048.
TASK 2: KNOW THE VALUE!
1 34410
5308
2 6148
39610
3 71510
13138
4 7018
44910
5 40910
6318
6 6528
42610
7 19910
3078
8 1448
10010
9 42310
528
10 4368
28610
READING 2: JAVA METHOD PARAMETERS
● You can also store the result in a variable public static void main(String[] args)
(recommended, as it is easier to read and { System.out.println(myMethod(5, 3));
maintain): }
}
// Outputs 8 (5 + 3)
}
static int myMethod(int x) {
Insert the missing part to print the
number 8 in main, by using a return 5 + x;
3 specific keyword inside }
myMethod: public static void main (String[] args)
{ System.out.println(myMethod(3));
}
}
}
This is the input of the program:
Input
Output
Last Name:
First Name:
Middle Name: