Klein Prep Computer Science
*********
*********
Due Date: August 18, 2023
Hello Klein Prep Students,
------------------------------------------------------
My Period 3 KP students complete this:
P3 - KP Computer Science: Multiple courses
Click on the link on the next line and sign up.
https://www.khanacademy.org/join/W895GZPS
Klein Prep Period 4 students,
-------------------------------------------------------
My Period 4 KP students complete this:
P4 - KP Computer Science Assignment.
Click on the link on the next line and sign up.
https://www.khanacademy.org/join/THU348DM
*********
*********
Due Date: August 25, 2023
java primitive data types "byte" size - PX_lastname_byte.png
-You will list all 8 of the java primitive data types
-indicate which are a part of the APCS A subset.
-Explain why 127 is the largest number
-allowed in the java data type "byte".
-Also, explain why I am able to store -128
-into the java data type "byte".
Take a picture of your work of the board showing your work.
Your file name will be PX_Lastname_byte.png
Turn it into google classroom.
Read the notes below:
Java eight primitive data types are:
byte 8 bits
short 16 bits
int 32 bits
long 64 bits
float 1/2 the size of double (decimal format)
double 2 times the size of float (decimal format)
boolean true/false
char single character
Why is java data type byte only stores up to 127 positive and 128 negative.
In Java, the `byte` type is an 8-bit data type that can store integer values in the range of -128 to 127. The reason for this range is due to the way binary representation and two's complement arithmetic work.
In two's complement representation, which is commonly used to represent signed integers in computers, the most significant bit (MSB), which is the leftmost bit, is used as the sign bit. If the sign bit is 0, the number is positive, and if it's 1, the number is negative. The remaining bits represent the magnitude of the number.
For an 8-bit two's complement representation, the range of values is from -2^7 (-128) to 2^7 - 1 (127). This is because the MSB represents the sign, and the remaining 7 bits represent the magnitude of the number.
Here's how it works:
- Binary representation of -128: 10000000
- Binary representation of -1: 11111111
- Binary representation of 0: 00000000
- Binary representation of 127: 01111111
As you can see, the leftmost bit (MSB) in these binary representations determines the sign of the number. If it's 0, the number is positive, and if it's 1, the number is negative. The `byte` type in Java follows this two's complement representation, allowing it to represent integers in the range of -128 to 127. This range is often sufficient for many use cases involving small integers, while also optimizing memory usage by using only 8 bits per value.
*********
*********
Due Date: August 25, 2023
Ascii Table - PX_lastname_Ascii.mp4
Complete Ascii table encoding on per Mr. Cusack instructions.
Be sure to put your name and class period on the board.
You will be recording your demo modeled after Mr. Cusack demonstration.
Your file name will be PX_lastname_Ascii.mp4
Drop this off into google classroom.
Read the notes below:
Gain an understanding of Ascii Table and how it relates to the Unicode table.
The ASCII (American Standard Code for Information Interchange) table is a character encoding standard that assigns unique numeric codes to represent characters in computers and communication equipment. It was developed in the early days of computing to provide a standardized way to represent characters using binary numbers, making it possible for different computer systems to communicate and exchange text-based information.
The ASCII table consists of a total of 128 character codes, each assigned a unique 7-bit binary number, ranging from 0 to 127. These codes represent a variety of characters, including letters (both uppercase and lowercase), digits, punctuation marks, control characters (such as newline and tab), and special characters.
For example, some common ASCII codes and their corresponding characters are:
- ASCII Code 65: Represents the uppercase letter 'A'
- ASCII Code 97: Represents the lowercase letter 'a'
- ASCII Code 48: Represents the digit '0'
- ASCII Code 32: Represents the space character
- ASCII Code 10: Represents the newline character
The ASCII table provided a consistent way to represent characters across different computer systems, making it possible to share text-based data and messages between different devices and software. However, as computing evolved and more characters were needed to represent different languages, symbols, and characters, the limitations of the 7-bit ASCII encoding became apparent.
To accommodate a wider range of characters, different character encoding standards like ISO-8859 and eventually Unicode were developed. Unicode, in particular, aims to cover virtually all characters and symbols from all writing systems, and it provides multiple encoding schemes, including UTF-8 and UTF-16, which can represent characters using more than 8 bits as needed.
While ASCII itself has largely been surpassed by more comprehensive and flexible character encodings like Unicode, its legacy remains in the foundation of many programming languages and systems, and it still serves as the basis for the first 128 characters of Unicode.
*********
*********
Due Date: August 25, 2023
Calculate subtraction in Binary - PX _lastname_2Complement.mp4
Complete a demo of subtraction on the board per Mr. Cusack instructions.
Be sure to put your name and class period on the board.
You will be recording your demo modeled after Mr. Cusack demonstration.
Your file name will be PX_lastname_2Complement.mp4
Drop this off into google classroom.
Read the notes below:
Calculate subtraction in Binary either the Board or
on Paper per Mr. Cusack instructions.
Take a picture with your name and class period on it.
Your file name will be PX _lastname_2Complement.jpg
Turn it into google classroom.
Read the notes below:
In Java, the two's complement is a fundamental concept used for representing and manipulating signed integer values. Two's complement is a binary representation that allows negative numbers to be represented by flipping the bits of the positive counterpart and then adding 1. This representation simplifies arithmetic operations and provides a convenient way to handle both positive and negative integers within a fixed number of bits.
Here's how two's complement works in Java:
1. **Positive Numbers:**
- Positive integers are represented using their regular binary representation, with no modifications needed. For example, the decimal number 5 would be represented as `00000101` in binary using 8 bits.
2. **Negative Numbers:**
- To represent a negative number, you first take the two's complement of its positive counterpart.
- To find the two's complement, you invert (flip) all the bits (0s become 1s and 1s become 0s) of the positive binary representation.
- Then, add 1 to the inverted result.
For example, let's consider an 8-bit representation:
- Decimal -3: Its positive counterpart is 3, which is `00000011` in binary.
- Invert the bits: `11111100`
- Add 1: `11111101`
So, the two's complement representation of -3 in an 8-bit system is `11111101`.
When you perform arithmetic operations in Java, including addition, subtraction, multiplication, and division, the two's complement representation ensures that these operations work consistently for both positive and negative numbers. The use of two's complement simplifies the hardware design of processors and allows them to perform arithmetic operations using the same logic gates for both signed and unsigned integers.
In modern computing systems, the details of two's complement representation are handled by the hardware and the programming language, like Java, abstracts these complexities away from the programmer. You can work with positive and negative integers in a natural way, and the underlying two's complement representation takes care of the required conversions and arithmetic operations.
*********
*********
*********
*********
Due Date: September 1, 2023
Enhanced Hello
-Complete this java program and drop
it off into google classroom
Purpose: To learn a few additional java commands
such as escape sequences and the println and print.
Click on this link here for you instructions.
http://www.cusack2.com/KCHS22_23/202209Sep/W05/03_KP/Other/NewHelloWorld%20.html
*********
*********
Due Date: September 1, 2023
FACE
-Purpose: to create a face. (must be 500 px by 500 px)
• Use Eclipse to program using java,
to create an image made up of
Unicode symbols and letters.
Click for you instructions.
http://www.cusack2.com/KCHS22_23/202209Sep/W05/03_KP/Other/Face.html
*********
*********
*********
*********
*********
*********
Due Date: September 5, 2023
We will be doing Computer math.
We will do it on the board:
Binary addition
Octal addition
Octal subtraction
Hexadecimal addition
Hexadecimal subtraction.
Decimal / binary conversion
Decimal / octal conversion
Decimal / hexadecimal conversion
*********
*********
Due Date: August ??, 2023
*********
*********
Due Date: August ??, 2023