cocs 202 progrmming i
play

COCS 202 Progrmming I Hossam M. J. Mustafa FCITR, KAUR Chapter 1 - PowerPoint PPT Presentation

COCS 202 Progrmming I Hossam M. J. Mustafa FCITR, KAUR Chapter 1 Introduction to Computers, Programs, and Java Liang, Introduction to Java Programming, Sixth Edition, (c) 2007 Pearson Education, Inc. All 1 rights reserved. 0-13-222158-6


  1. COCS 202 Progrmming I Hossam M. J. Mustafa FCITR, KAUR Chapter 1 Introduction to Computers, Programs, and Java Liang, Introduction to Java Programming, Sixth Edition, (c) 2007 Pearson Education, Inc. All 1 rights reserved. 0-13-222158-6

  2. Chapter 1 Introduction to Computers, Programs, and Java Basic computer skills such as using Windows, Internet Explorer, and Microsoft Word Chapter 1 Introduction to Computers, Programs, and Java Chapter 2 Primitive Data Types and Operations Chapter 3 Selection Statements Chapter 4 Loops Chapter 5 Methods Chapter 6 Arrays Liang, Introduction to Java Programming, Sixth Edition, (c) 2007 Pearson Education, Inc. All 2 rights reserved. 0-13-222158-6

  3. What is a Computer? A computer consists of a CPU, memory, hard disk, floppy disk, monitor, printer, and communication devices. Bus Output Communication Input Storage Memory CPU Devices Devices Devices Devices e.g., Monitor, e.g., Disk, CD, e.g., Keyboard, e.g., Modem, Printer and Tape Mouse and NIC Liang, Introduction to Java Programming, Sixth Edition, (c) 2007 Pearson Education, Inc. All 3 rights reserved. 0-13-222158-6

  4. CPU - The central processing unit (CPU) is the brain of a computer. - It retrieves instructions from memory and executes them. - The CPU speed is measured in megahertz (MHz). Bus Output Communication Input Storage Memory CPU Devices Devices Devices Devices e.g., Monitor, e.g., Disk, CD, e.g., Keyboard, e.g., Modem, Printer and Tape Mouse and NIC Liang, Introduction to Java Programming, Sixth Edition, (c) 2007 Pearson Education, Inc. All 4 rights reserved. 0-13-222158-6

  5. Memory - Memory : store data and program instructions for CPU to execute. - A memory unit is an ordered sequence of bytes. - The current content of a memory byte is lost whenever new information is placed in it. - Memory is volatile, because information is lost when the power is off. Bus Output Communication Input Storage Memory CPU Devices Devices Devices Devices e.g., Monitor, e.g., Disk, CD, e.g., Keyboard, e.g., Modem, Printer and Tape Mouse and NIC Liang, Introduction to Java Programming, Sixth Edition, (c) 2007 Pearson Education, Inc. All 5 rights reserved. 0-13-222158-6

  6. How Data is Stored? - Data of various kinds: such as numbers, characters, and strings, are encoded as a series of bits (zeros and ones). - Computers use zeros and ones because Memory address Memory content digital devices have two stable states, which . . are referred to as zero and one by . . convention. . . - The encoding scheme varies. For example, Encoding for character ‘J’ 2000 01001010 character ‘ J ’ is represented by 01001010 in 2001 01100001 Encoding for character ‘a’ one byte. A small number such as three can 2002 01110110 Encoding for character ‘v’ be stored in a single byte. 2003 01100001 Encoding for character ‘a’ 2004 00000011 Encoding for number 3 Liang, Introduction to Java Programming, Sixth Edition, (c) 2007 Pearson Education, Inc. All 6 rights reserved. 0-13-222158-6

  7. Storage Devices Programs and data are permanently stored on storage devices and are moved to memory when the computer actually uses them. There are three main types of storage devices:Disk drives (hard disks and floppy disks), CD, DVD drives (CD-R, CD-RW and DVD), Tape drives and Compact Flash card . Bus Output Communication Input Storage Memory CPU Devices Devices Devices Devices e.g., Monitor, e.g., Disk, CD, e.g., Keyboard, e.g., Modem, Printer and Tape Mouse and NIC Liang, Introduction to Java Programming, Sixth Edition, (c) 2007 Pearson Education, Inc. All 7 rights reserved. 0-13-222158-6

  8. Output Devices: Monitor The monitor displays information (text and graphics). The resolution and dot pitch determine the quality of the display. Bus Output Communication Input Storage Memory CPU Devices Devices Devices Devices e.g., Monitor, e.g., Disk, CD, e.g., Keyboard, e.g., Modem, Printer and Tape Mouse and NIC Liang, Introduction to Java Programming, Sixth Edition, (c) 2007 Pearson Education, Inc. All 8 rights reserved. 0-13-222158-6

  9. Monitor Resolution and Dot Pitch resolution The resolution specifies the number of pixels per square inch. Pixels (short for “ picture elements ” ) are tiny dots that form an image on the screen. The higher the resolution, the sharper and clearer the image is. dot pitch The dot pitch is the amount of space between pixels. The smaller the dot pitch, the better the display. Liang, Introduction to Java Programming, Sixth Edition, (c) 2007 Pearson Education, Inc. All 9 rights reserved. 0-13-222158-6

  10. Communication Devices - A regular modem uses a phone line and can transfer data in a speed up to 56,000 bps (bits per second). - A DSL (digital subscriber line) also uses a phone line and can transfer data in a speed 20 times faster than a regular modem. - Network interface card ( NIC ) is a device to connect a computer to a local area network (LAN). The LAN is commonly used in business, universities, and government organizations. A typical type of NIC, called 10BaseT , can transfer data at 10 mbps (million bits per second). Bus Output Communication Input Storage Memory CPU Devices Devices Devices Devices e.g., Monitor, e.g., Disk, CD, e.g., Keyboard, e.g., Modem, Printer and Tape Mouse and NIC Liang, Introduction to Java Programming, Sixth Edition, (c) 2007 Pearson Education, Inc. All 10 rights reserved. 0-13-222158-6

  11. Programs Computer programs , known as software , are instructions to the computer. You tell a computer what to do through programs. Without programs, a computer is an empty machine. Programs are written using programming languages. Liang, Introduction to Java Programming, Sixth Edition, (c) 2007 Pearson Education, Inc. All 11 rights reserved. 0-13-222158-6

  12. Programming Languages Machine Language Assembly Language High-Level Language - Machine language is a set of primitive instructions built into every computer. - The instructions are in the form of binary code. - Program are highly difficult to read and modify. For example, to add two numbers, you might write an instruction in binary like this: 1101101010011010 Liang, Introduction to Java Programming, Sixth Edition, (c) 2007 Pearson Education, Inc. All 12 rights reserved. 0-13-222158-6

  13. Programming Languages Machine Language Assembly Language High-Level Language - Assembly languages were developed to make programming easy. - A program called assembler is used to convert assembly language programs into machine code. - For example, to add two numbers, you might write an instruction in assembly code like this: ADDF3 R1, R2, R3 Assembly Source File Machine Code File … … Assembler ADDF3 R1, R2, R3 1101101010011010 … … Liang, Introduction to Java Programming, Sixth Edition, (c) 2007 Pearson Education, Inc. All 13 rights reserved. 0-13-222158-6

  14. Programming Languages Machine Language Assembly Language High-Level Language The high-level languages are English-like and easy to learn and program. For example, the following is a high-level language statement that computes the area of a circle with radius 5: area = 5 * 5 * 3.1415; Liang, Introduction to Java Programming, Sixth Edition, (c) 2007 Pearson Education, Inc. All 14 rights reserved. 0-13-222158-6

  15. Popular High-Level Languages  COBOL (COmmon Business Oriented Language)  FORTRAN (FORmula TRANslation)  BASIC (Beginner All-purpose Symbolic Instructional Code)  Pascal (named for Blaise Pascal)  Ada (named for Ada Lovelace)  C (whose developer designed B first)  Visual Basic (Basic-like visual language developed by Microsoft)  Delphi (Pascal-like visual language developed by Borland)  C++ (an object-oriented language, based on C)  Java (We use it in the book) Liang, Introduction to Java Programming, Sixth Edition, (c) 2007 Pearson Education, Inc. All 15 rights reserved. 0-13-222158-6

  16. Compiling Source Code - A program written in a high-level language is called a s ource program . - Program called a compiler is used to translate the source program into a machine language program called an object program . - The object program is often then linked and executed on the machine. Source File Compiler Object File Excutable File Linker Liang, Introduction to Java Programming, Sixth Edition, (c) 2007 Pearson Education, Inc. All 16 rights reserved. 0-13-222158-6

  17. Compiling Java Source Code  Java was designed to run object programs on any platform.  In Java, you write the program once, and compile the source program into a special type of object code, known as bytecode .  The bytecode can then run on any computer with a Java Virtual Machine, as shown in Figure 1.5.  Java Virtual Machine is a software that interprets Java bytecode. Java Bytecode Java Virtual Machine Any Computer Liang, Introduction to Java Programming, Sixth Edition, (c) 2007 Pearson Education, Inc. All 17 rights reserved. 0-13-222158-6

  18. Operating Systems The operating system (OS) is a program that manages and User controls a computer ’ s activities. Application Programs MS Windows is currently the most popular PC operating Operating System system. Application programs such as Hardware an Internet browser and a word processor cannot run without an operating system. Liang, Introduction to Java Programming, Sixth Edition, (c) 2007 Pearson Education, Inc. All 18 rights reserved. 0-13-222158-6

Recommend


More recommend