510 likes | 1.08k Views
OVERVIEW OF COMPUTER AND PROGRAMMING. 1.1 Computer Components and Operations 1.2 Steps Involved in the Programming Process 1.3 Interactive Input 1.4 Data Hierarchy and File Input 1.5 Flowchart Symbols and Pseudocode Statements 1.6 Name Variables, Assign values to Variables
E N D
OVERVIEW OF COMPUTER AND PROGRAMMING 1.1 Computer Components and Operations 1.2 Steps Involved in the Programming Process 1.3 Interactive Input 1.4 Data Hierarchy and File Input 1.5 Flowchart Symbols and Pseudocode Statements 1.6 Name Variables, Assign values to Variables 1.7 Sentinel, or Dummy Value to End Program 1.8 Manage Large Flowchart 1.9 Data Types, the Evolution of Programming Techniques
1.1 Computer components and operations COMPONENTS • Hardware • equipment / device • Software • instructions that tell the computer what to do • written by programmers. • 2 types • System software • Eg: OS, Windows, DOS, Unix • Application software • Eg: Adobe, Ms Office, Games, etc
1.1 Computer components and operations (CONT…) • OPERATIONS • Input • keyboard, mice, data • Processing • CPU (Central Processing Unit) • Output • printer, monitor, information • Storage • magnetic disks, tapes, • compact discs, flash media INPUT PROCESS OUTPUT
1.1 Computer components and operations (CONT…) • Programming language • Eg: Visual basic, C, C++, Java, COBOL • Machine language • Binary form – 0,1 • Compiler / interpreter • The language translation software that convert a programmer’s statement to binary form • Storage • Internal storage – RAM (volatile) • External storage – floppy disk, hard disk, flash media (permanent) • Language syntax • Rules governing its word usage and punctuation.
1.1 Computer components and operations (CONT…) TWO TRUTH AND A LIE Application software comprises the programs that you use to manage your computer such as operating systems FALSE 2. Data includes all the text, numbers and other information that are processed by a computers TRUE 3. Programming languages have rules governing word usage and punctuation; these rules are called the language’s syntax. TRUE
1.2 Steps involved in the programming process • Six Programming Steps • Understanding the problem • Planning the logic • Coding the program • Using software to translate the program into machine language • Testing the program • Putting the program into production
1.2 Steps involved in the programming process (CONT…) 1. UNDERSTANDING THE PROBLEM • Understand the whole problem • Programmer ask user, what they need • Difficult aspects of programming • Example : • Sistempendaftaranpelajar • Programmer ask staff management, what they want in the system • Name • No matrik • No kp • Address. • No phone
1.2 Steps involved in the programming process (CONT…) 2. PLANNING THE LOGIC • Programmer plan the steps of the program • Planning tools • Pseudocode • flowchart • Doesn’t worry about syntax • Sequence of events (input / output) • Desk checking • Program’s logic on paper before write the program.
1.2 Steps involved in the programming process (CONT…) 3. CODING THE PROGRAM • Convert the logic (pseudocode/flowchart) into programming • Use Programming language (C, C++, Java, etc) • Input operations • Arithmetic processing • Output operations • Other standard functions • Using the corrects syntax • CODING • Writing the statements in a programming language.
1.2 Steps involved in the programming process (CONT…) 4. USING SOFTWARE TO TRANSLATE THE PROGRAM INTO MACHINE LANGUAGE • Computer understand – machine language(binary number – 0,1) • Translator / Compiler / Interpreter • Change English-like high-level programming language in which programmer writes into the low-level machine language that the computer understands. • Syntax error • Error in language and grammar
1.2 Steps involved in the programming process (CONT…) 5.TESTING THE PROGRAM • Free from logical error • Incorrect instruction are performed or • Instructions are performed in the wrong order 6. PUTTING THE PROGRAM INTO PRODUCTION • Ready for the organization to use.
ANALISA & MEMBENTUK ALGORITMA SPESIFIKASI MASALAH /KEPERLUAN MENULIS ATURCARA (PENGATUCARAAN) MENGUJI & MENYAHRALAT (TESTING & DEBUGGING) PENGATURCARA LARIAN ATURCARA YANG TELAH DIBANGUNKAN 1.2 Steps involved in the programming process (CONT…)
1.2 Steps involved in the programming process (CONT…) TWO TRUTH AND A LIE Understanding the programming problem may be one of the most difficult aspects of programming TRUE 2. The two most commonly used logic-planning tools are flowchart and pseudocode TRUE 3. Flowcharting a program is a very different process if you will be using an older programming language instead of a newer one. FALSE
1.3 Interactive input • Data values entered from a keyboard • Prompt – message displayed on a monitor, asking the user for a response • Command prompt – (computer’s OS using text) • GUI – graphical environment
1.3 Interactive input (CONT…) • Command Line Environment • GUI Environment
1.3 Interactive input (CONT…) TWO TRUTH AND A LIE A prompt is a message that is displayed on a monitor, asking the user for a response. TRUE 2. The command prompt allows users to interact with a program in a graphical nontext environment. FALSE 3. The logic for a command line interactive program and a GUI interactive program basically the same. TRUE
1.4 Data hierarchy and file input • Eg: list thousands of people (personnel, student) • Field – single data item (eg: name, address, salary) • Records – groups of fileds (eg: Student record – NoMatrik, Grade) • Files – groups of records (eg: Students in your class) • Database - groups of files (tables) • Queries – related data items.
1.4 Data hierarchy and file input (CONT…) BIODATA PENSYARAH BIODATA PELAJAR PENGINAPAN PELAJAR GAJI PENSYARAH File Record RESULT PELAJAR MAKLUMAT KELUARGA Field
1.4 Data hierarchy and file input (CONT…) TWO TRUTH AND A LIE In the data hierarchy, a field is a single data item, such as lastname, streetaddressor salary. TRUE 2. In the data hierarchy, fields are grouped together to form a record; record are groups of fields that go together for some logical reason. TRUE 3. In the data hierarchy, related records are grouped together to form a field. FALSE
Latihan (1.1 – 1.4) • Nyatakanempat (4) operasikomputer • Senaraikanenam (6) prosespengaturcaraan • Berikantiga (3) contohbahasapengaturcaraan • Apakahtugas “Programmer”? • Terangkansecararingkasfasa ke-2 dalamprosespengaturcaraan. • Terangkansecararingkasmaksudungkapandibawah: • Prompt • Machine language • Command prompt • Logical error • Syntax • Software • Desk-checking • Compiler • coding
1.5 Flowchart symbols and pseudocode statements FLOWCHART • Pictorial representation of the logical steps it takes to solve a problem. PSEUDOCODE • English-like representation of the same thing. WRITING PSEUDOCODE
1.5 Flowchart symbol and pseudocode statements (CONT…) • Pseudocode • Not final product • Flexible • Example • Start/stop begin/end • Input myNumber get myNumber read myNumber • set myAnswer = myNumber * 2 calculate myAnswer = myNumber times 2 compute myAnswer as myNumber doubled myAnswer = myNumber * 2 • Output myAnswer display myAnswer write myAnswer print myAnswer
1.5 Flowchart symbol and pseudocode statements (CONT…) DRAWING FLOWCHARTS • Parallelogram • - input symbol • Arrow / Flowlines • - Connect the steps • Rectangle • - processing symbol • Terminal symbols • - Start / Stop • Parallelogram • - output symbol
1.5 Flowchart symbol and pseudocode statements (CONT…) • Flowchart and pseudocode of program that doubles a number
1.5 Flowchart symbol and pseudocode statements (CONT…) • After developed flowchart or pseudocode • Buy a computer • Buy a language compiler • Learn a programming language • Code the program • Attempt to compile it • Fix the syntax error • Compile it again • Test with several sets of data • Put into production
1.6 Name variables, assign values to variables • VARIABLES / IDENTIFIER • Name memory location. Eg: • RULES FOR NAMING VARIABLES. • Must be one word (no space) • Cannot used any symbol (eg: > + ) & $ @ # . ? ) • Some appropriate meaning • Cannot start with number
1.6 Name variables, Assign values to variables(CONT…) • ASSIGNMENT STATEMENTS • Eg: calculatedAnswer = inputNumber*2 luasSegiempat = panjang * lebar kuasa_3 = nom * nom * nom purata = (Uj1+Uj2+Uj3)/3 punca = b*b – (4*a*c) • Assignment operator • Equal sign • Left side – name the location where the result will be stored • Rules of precedence • Egd = a + b * c d = (a + b) * c
1.6 Name variables, Assign values to variables(CONT…) The equal assignment operator always requires the name of a memory location on its right side. FALSE 2. Variable names are easier to remember than memory addresses. TRUE 3. A variable name is also called an identifier. TRUE 4. Variable names must be one word, without spaces TRUE 5. As a programmer, you choose specific memory addresses for your variables. FALSE
LATIHAN Binapseudocodeutksoalan 1 dan 2, Binacartalirutksoalan 3 dan 4. • Mengiraluassegitiga • Mencarikuasa 4 baginombor yang dimasukkan • Mengiraisipadusfera isipadu = 4/3 j3 • Mengiragaji Gaji = (jam * 5.00) + bonus + elaun
1.7 Sentinel, or dummy value to end program • Infinite loop • Repeating flow of logic with no end • Making decision • Testing a value • Use decision symbol (diamond shape) • Dummy value / Sentinel value • Preselected value that stops the execution of a program • eof • end-of-file
1.7 Sentinel, or dummy value to end program (CONT…) Program with sentinel value of 0 Flowchart using eof Start Start get No get No No = 0? eof? Stop Stop Ans = No * 2 Ans = No * 2 print Ans print Ans
1.7 Sentinel, or dummy value to end program (CONT…) TWO TRUTH AND A LIE A program that contains an infinite loop is one that never ends. TRUE 2. A preselected value that stops the execution of a program is often called a dummy value or a sentinel value. TRUE 3. Many programming languages use the term fe(for “file end”) to talk about a marker that automatically acts as a sentinel. FALSE
1.8 Manage large flowchart • on-page connector symbol • Circle • off-page connector symbol • Square with pointed bottom
1.8 Manage large flowchart(CONT…) Flowchart using the connector 1 start Step 1 Step 1 Step 1 Step 1 Step 1 Step 1 1 p.2 A
1.8 Manage large flowchart(CONT…) TWO TRUTH AND A LIE You can use a connector when limited page size forces you to continue a flowchart in an unconnected location or on another page. TRUE 2. By convention, programmers use a parallelogram as an on-page connector symbol. TRUE 3. By convention, programmers use a symbol that look like a square with a pointed bottom as an off-page connector symbol. FALSE
1.9 Data types, the evolution of programming technique DATA TYPES • Text • String constant / text constant • String variable / text variable • Numeric • Numeric constant • Numeric variable • Integer • Floating-point (fractional) Constant – value doesn’t change Variable– value can change
1.9 Data types, the evolution of programming techniques (CONT…) Example: • Numeric Integer – Bil, NoKP • Numeric Floating point – PNG, Byrn • Text string – Nama, Kolej • Text char – Jantina, Gred Variable • Numeric Integer - Markah = 90 • Numeric Floating point – PIE = 3.142 • Text string – Nama = “Siti” • Text char – Gred = “E” Constant
1.9 Data types, the evolution of programming techniques (CONT…) • Example: • LuasS4 = Panjang * Lebar Numeric Integer – LuasS4, Panjang, Lebar • LuasS3 = 0.5 * Tapak * Tinggi Numeric Integer – Tapak, Tinggi Numeric floating point – LuasS3 • Gaji = (jam * 5.50) + elaun + Bonus Numeric floating point – Gaji, elaun, Bonus, jam • If Markah >= 80 Gred = ‘A’ Numeric Integer – Markah Text char – Gred
1.9 Data types, the evolution of programming techniques (CONT…) EVOLUTION OF PROGRAMMING TECHNIQUES • Procedural programming • Focuses on the procedure (programmers create) • Input Proses Output • Object-oriented programming • Focuses on objects or “thing” • Describe features, attributes, behaviors • DDC1023 – focuses on procedural programming techniques.
1.9 Data types, the evolution of programming techniques (CONT…) A Variable’s data type describes the kind of values the variable can hold and the types of operations that can be performed with it. TRUE 2. If name is a string variable, then the statement name=“Ed” is valid. TRUE 3. If salary is a numeric variable, then the statement salary=“12.50” is valid. FALSE 4. Procedural programmers focus on actions that are carried out by a program. TRUE 5. Object-oriented programmers focus on a program’s objects and their attributes and behaviors. TRUE