Download presentation
Presentation is loading. Please wait.
Published byHollie Hawkins Modified over 9 years ago
1
Introduction to Programming Prof. Rommel Anthony Palomino Department of Computer Science and Information Technology Spring 2011
2
Number Systems and Conversions Rommel AB Palomino - UDC Spring 20112 001000000001 0010 0000 2020 21212 2323 2012
3
Number Systems and Conversions Rommel AB Palomino - UDC Spring 20113 Numbers can be represented in many ways There exist many Numeral System or ways to represent numbers. Their representation depends on something called BASE BASE - 1 is the maximum number you can represent using a single digit. Base 10 Max number using single digit = 10 – 1 = 9
4
Number Systems and Conversions Rommel AB Palomino - UDC Spring 20114 The most well known numeral system is the Decimal System. The one you use everyday. Base 10 It consist of 10 elements from 0-9. Besides decimals, there exists others such as: Binary: Base 2. Uses 2 elements. 0 to 1 Octal: Base 8. Uses 8 elements. 0 to 8. Hexadecimal: ????
5
Number Systems and Conversions Rommel AB Palomino - UDC Spring 20115 Hexadecimal: Uses up to 16 digits. From 0 to 15 ??? HexDec 00 11 22 33 …… 99 A10 B11 C12 D13 E14 F15
6
Number Systems and Conversions Rommel AB Palomino - UDC Spring 20116 Hexadecimal: Uses up to 16 digits. From 0 to 15 ??? HexDec 00 11 22 33 …… 99 A10 B11 C12 D13 E14 F15 FF 16 = 255 10
7
Conversion: Decimal to Binary Rommel AB Palomino - UDC Spring 20117 Method: Continuously divide the number by 2 get the remainder (which is either 0 or 1) get that number as a digit of the binary form of the number get the quotient and divide that number again by 2 repeat the whole process until the quotient reaches 0 or 1 we then get all the remainders starting from the last remainder, and the result is the binary form of the number NOTE: For the last digit which is already less than the divisor (which is 2) just copy the value to the remainder portion.
8
Conversion: Decimal to Binary Rommel AB Palomino - UDC Spring 20118 Example Convert 150 10 to Binary Solution: 10010110 = 150 NumberBaseQuotientRemainder 1502750 2371 2181 290 9241 4220 2210 1201
9
Conversion: Binary to Decimal Rommel AB Palomino - UDC Spring 20119 Method: we multiply the binary digit to "2 raised to the position of the binary number" We then add all the products to get the resulting decimal number.
10
Conversion: Binary to Decimal Rommel AB Palomino - UDC Spring 201110 Example Convert 11100101 2 to Decimal 0: 1 2: 4 5: 32 6: 64 7: 128 Solution: 229
11
Conversion: Binary to Hexadecimal Rommel AB Palomino - UDC Spring 201111 Method: Partition the binary number into groups of 4 digits (from right to left) pad it with zeros if the number of digits is not divisible by 4 convert each partition into its corresponding hexadecimal digit
12
Conversion: Binary to Hexadecimal Rommel AB Palomino - UDC Spring 201112 Example Convert 11100101 2 to Hexadecimal Solution:
13
Programming Fundamentals Rommel AB Palomino - UDC Spring 201113
14
Introduction to Java Rommel AB Palomino - UDC Spring 201114 The original motivation for Java The need for platform independent language that could be embedded in various consumer electronic products.
15
Introduction to Java Rommel AB Palomino - UDC Spring 201115 The Java technology is: A programming language A development environment An application environment A deployment environment
16
Introduction to Java Rommel AB Palomino - UDC Spring 201116 As a development environment, Java technology provides you with a large suite of tools: A compiler An interpreter A documentation generator, etc
17
Java Features Rommel AB Palomino - UDC Spring 201117 Some features of Java: The Java Virtual Machine Bytecode Garbage Collection
18
Java Features Rommel AB Palomino - UDC Spring 201118 Java Virtual Machine (JVM) an imaginary machine that is implemented by emulating software on a real machine provides the hardware platform specifications to which you compile all Java technology code
19
Java Features Rommel AB Palomino - UDC Spring 201119 Bytecode a special machine language that can be understood by the Java Virtual Machine (JVM) independent of any particular computer hardware, so any computer with a Java interpreter can execute the compiled Java program, no matter what type of computer the program was compiled on
20
Java Features Rommel AB Palomino - UDC Spring 201120 Garbage collection thread responsible for freeing any memory that can be freed. This happens automatically during the lifetime of the Java program. programmer is freed from the burden of having to deallocate that memory themselves
21
How a Java Program works? Rommel AB Palomino - UDC Spring 201121
22
Exercise Write a flowchart for How to answer and end a phone call in your Cellphone 22Rommel AB Palomino - UDC Spring 2011
23
Questions? 23Rommel AB Palomino - UDC Spring 2011
24
For Next Class Rommel AB Palomino - UDC Spring 201124 We will do our first Java Program and will learn how to use our Programming Environment
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.