Introduction to Programming Prof. Rommel Anthony Palomino Department of Computer Science and Information Technology Spring 2011.

Slides:



Advertisements
Similar presentations
NUMBER SYSTEM. How to convert hexadecimal numbers to decimal numbers? 230 Working from right to left, MULTIPLY each position with 8 raised to the power.
Advertisements

DATA REPRESENTATION CONVERSION.
James Tam Beyond Base 10: Non-decimal Based Number Systems What is the decimal based number system? How do other number systems work (binary, octal and.
James Tam Beyond Base 10: Non-decimal Based Number Systems What is the decimal based number system? How do other number systems work (binary, octal and.
James Tam Beyond Base 10: Non-decimal Based Number Systems What is the decimal based number system? How do other number systems work (binary, octal and.
Data Representation in Computers
Computer Systems 1 Fundamentals of Computing
Number Systems and Arithmetic
Binary Numbers.
Data Representation in Computers. Data Representation in Computers/Session 3 / 2 of 33 Number systems  The additive approach – Number earlier consisted.
© GCSE Computing Candidates should be able to:  convert positive denary whole numbers (0-255) into 8-bit binary numbers and vice versa  add two 8-bit.
Real Numbers and the Decimal Number System
Introduction to Programming Prof. Rommel Anthony Palomino Department of Computer Science and Information Technology Spring 2011.
Introduction to Java Kumar Harshit. Objectives ( 목적지 ) At the end of the lesson, the student should be able to: ● Describe the features of Java technology.
Numbering Systems CS208.
Comp Sci 251 Intro 1 Computer organization and assembly language Wing Huen.
Introduction to the Java Virtual Machine 井民全. JVM (Java Virtual Machine) the environment in which the java programs execute The specification define an.
The Wonders of Conversion. A number system is a system in which a number is represented. There are potential infinite number systems that can exist (there.
CCE-EDUSAT SESSION FOR COMPUTER FUNDAMENTALS Date: Session III Topic: Number Systems Faculty: Anita Kanavalli Department of CSE M S Ramaiah.
Number systems, Operations, and Codes
Digital Logic Lecture 2 Number Systems
Chapter1: Number Systems
Positional Notation 642 in base 10 positional notation is:
Number Base Conversions
Digital Electronics Octal & Hexadecimal Number Systems.
Number System sneha.
Chapter 2 Number Systems Consists of a set of symbols called digits and a set of relations such as +, -, x, /.
 Programming - the process of creating computer programs.
Octal & Hexadecimal Number Systems
Introduction To Number Systems Binary System M. AL-Towaileb1.
CDA 3100 Fall2009. Special Thanks Thanks to Dr. Xiuwen Liu for letting me use his class slides and other materials as a base for this course.
Computer Number System
Dale Roberts Department of Computer and Information Science, School of Science, IUPUI CSCI 230 Information Representation: Positive Integers Dale Roberts,
Number Systems. Topics  The Decimal Number System  The Binary Number System  Converting from Binary to Decimal  Converting from Decimal to Binary.
 2012 Pearson Education, Inc. Slide Chapter 4 NumerationSystems.
ECE 2110: Introduction to Digital Systems Number Systems: conversions.
The Hexadecimal System is base 16. It is a shorthand method for representing the 8-bit bytes that are stored in the computer system. This system was chosen.
Introduction to Programming 1 1 2Introduction to Java.
Chapter 01 Numbers. Chapter 02 Base 10 example Decimal Number Place Place (place - 1) ===============================
Chapter 4 Numeration and Mathematical Systems © 2008 Pearson Addison-Wesley. All rights reserved.
ECE 2110: Introduction to Digital Systems Number Systems: conversions.
Number Systems & Binary Arithmetic
Introduction To Number Systems
Digital Design Chapter One Digital Systems and Binary Numbers
NUMBER SYSTEMS.
Numeric Data Representation
Octal to Decimal Decimal Octal Binary Hexadecimal.
Discrete Mathematics Numbering System.
Integer Real Numbers Character Boolean Memory Address CPU Data Types
Topic: Difference b/w JDK, JRE, JIT, JVM
COMPUTING FUNDAMENTALS
CSE 102 Introduction to Computer Engineering
Number System conversions
Unit# 8: Introduction to Computer Programming
Number Systems and Binary Arithmetic
Introduction to IT By: Muhammed s. anwar.
Dr. Clincy Professor of CS
Numbering System TODAY AND TOMORROW 11th Edition
CDA 3100 Spring 2010.
Digital Electronics and Microprocessors
Chapter Four Data Representation in Computers By Bezawit E.
Chapter 2 Number Systems.
Chapter 2 Number Systems.
Chapter 2 Number Systems.
Beyond Base 10: Non-decimal Based Number Systems
Introduction To Number Systems
Computer Programming (CS101) Lecture-02
Chapter 2 Number Systems.
Dr. Clincy Professor of CS
Dr. Clincy Professor of CS
Presentation transcript:

Introduction to Programming Prof. Rommel Anthony Palomino Department of Computer Science and Information Technology Spring 2011

Number Systems and Conversions Rommel AB Palomino - UDC Spring 

Number Systems and Conversions Rommel AB Palomino - UDC Spring  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

Number Systems and Conversions Rommel AB Palomino - UDC Spring  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: ????

Number Systems and Conversions Rommel AB Palomino - UDC Spring  Hexadecimal: Uses up to 16 digits.  From 0 to 15 ??? HexDec …… 99 A10 B11 C12 D13 E14 F15

Number Systems and Conversions Rommel AB Palomino - UDC Spring  Hexadecimal: Uses up to 16 digits.  From 0 to 15 ??? HexDec …… 99 A10 B11 C12 D13 E14 F15 FF 16 =

Conversion: Decimal to Binary Rommel AB Palomino - UDC Spring  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.

Conversion: Decimal to Binary Rommel AB Palomino - UDC Spring  Example  Convert to Binary  Solution: = 150 NumberBaseQuotientRemainder

Conversion: Binary to Decimal Rommel AB Palomino - UDC Spring  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.

Conversion: Binary to Decimal Rommel AB Palomino - UDC Spring  Example  Convert to Decimal 0: 1 2: 4 5: 32 6: 64 7: 128  Solution: 229

Conversion: Binary to Hexadecimal Rommel AB Palomino - UDC Spring  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

Conversion: Binary to Hexadecimal Rommel AB Palomino - UDC Spring  Example  Convert to Hexadecimal  Solution:

Programming Fundamentals Rommel AB Palomino - UDC Spring

Introduction to Java Rommel AB Palomino - UDC Spring  The original motivation for Java  The need for platform independent language that could be embedded in various consumer electronic products.

Introduction to Java Rommel AB Palomino - UDC Spring  The Java technology is:  A programming language  A development environment  An application environment  A deployment environment

Introduction to Java Rommel AB Palomino - UDC Spring  As a development environment, Java technology provides you with a large suite of tools:  A compiler  An interpreter  A documentation generator, etc

Java Features Rommel AB Palomino - UDC Spring  Some features of Java:  The Java Virtual Machine  Bytecode  Garbage Collection

Java Features Rommel AB Palomino - UDC Spring  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

Java Features Rommel AB Palomino - UDC Spring  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

Java Features Rommel AB Palomino - UDC Spring  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

How a Java Program works? Rommel AB Palomino - UDC Spring

Exercise  Write a flowchart for  How to answer and end a phone call in your Cellphone 22Rommel AB Palomino - UDC Spring 2011

Questions? 23Rommel AB Palomino - UDC Spring 2011

For Next Class Rommel AB Palomino - UDC Spring  We will do our first Java Program and will learn how to use our Programming Environment