Class 2 ~ Chapter 1 CSE 1340 Introduction to Computing Concepts Class 2 Class 2 ~ Chapter 1 Review of course requirements: Homework due Tuesday at beginning of class-- no lates accepted Programming assignments due during lab hour or at the latest, 5pm the next day Student’s responsibility to have work turned in on-time or early. Programs and their associated files must be uploaded to Blackboard by the due date/time Review of course requirements: Class 2 ~ Chapter 1 Review of course requirements: – Incentives for coming to class lecture on Tuesdays and Thursdays • Unannounced quizzes • Unannounced fun logical quizzes and bonus opportunities given for getting back points lost on turned in homework assignment for that week • Interactive Class notes distributed Review of course requirements: Class 2 ~ Chapter 1 Must enroll in a lab Lab sessions are mandatory Pop Quizzes cannot be made up Homework cannot be made up Programs can be turned in late BUT only 1 day late; no late points assessed Make-up exams only given if documented excuse has been submitted BEFORE exam Communication Office hours via email: Class 2 ~ Chapter 1 – Please identify yourself Blackboard address – http://courses.smu.edu (use your 8 digit smu id for your userid and password) Synchronization of passwords Class 2 ~ Chapter 1 You can change your password in Blackboard by going to your homepage and clicking on “change password” in the upper right-hand corner of the window. Class 02 objectives Class 2 ~ Chapter 1 List the basic components of a computer system Understand what a Computer Program is List the Programming Life-Cycle Phases Describe the characteristics of Java Explain the uses of Java and identify types of Java programs. Computer Systems: Hardware and Software Class 2 ~ Chapter 1 Hardware --- the equipment Software --- programs that run the equipment Computer Components-Hardware Class 2 ~ Chapter 1 Peripherals Input Device Central Processing Unit ( CPU ) Control Unit Arithmetic Logic Unit Output Device Secondary (Auxiliary) Storage Device Memory Unit ( RAM & Registers ) Class 2 ~ Chapter 1 Memory Unit is an ordered sequence of storage cells, each capable of holding a piece of information each cell has its own unique address the information held can be input data, computed values, or your program instructions. Central Processing Unit Class 2 ~ Chapter 1 has 2 components to execute program instructions – Arithmetic/Logic Unit performs arithmetic operations, and makes logical comparisons. – Control Unit controls the order in which your program instructions are executed. Peripherals Class 2 ~ Chapter 1 are input, output, or auxiliary storage devices attached to a computer – Input Devices include keyboard and mouse. – Output Devices include printers, video display, LCD screens. – Auxiliary/Secondary Storage Devices include disk drives, scanners, CD-ROM and DVD-ROM drives, modems, sound cards, speakers, and digital cameras. WHAT IS A PROGRAM? Class 2 ~ Chapter 1 A program is a step-by-step series of instructions for a computer Computer programming is the process of writing these instructions Programmers, or developers, design and write programs using a programming language or development tool Java is a programming language that provides the structure for efficient and economical programs Class 2 ~ Chapter 1 A SET OF INSTRUCTIONS 1. Display a message on the screen asking “How many hours did you work?” 2. Wait for the user to enter the hours. Once the user enter the hours, store it in memory 3. Display a message on the screen that asks “How much do you get paid per hour?” 4. Wait for the user to enter the rate of pay. Once the user enters the rate, store it in memory 5. Multiply hours by rate and store the result in memory as gross pay Page 7 6. Display the gross pay Class 2 ~ Chapter 1 Inside the Program PROCESSING INPUT OUTPUT number System.out.print(sum); =keyboard.nextInt(); sum = sum + number; The Programming Process Class 2 ~ Chapter 1 Analyze the requirements – Precisely define what problem is to be solved Design the solution – flowchart – pseudocode Validate the design Implement the design – Code the program Test (debug) the solution (compile/run) – Syntax errors – Logical errors Document the program Class 2 ~ Chapter 1 Program Development Cycle Phase 1 – Analyze the Requirements Verify that the requirements are clear and complete Evaluate the problem to determine that it is solvable using a program List the required input and output data Determine whether the input data is available for testing Class 2 ~ Chapter 1 Phase 1 – Analyze the Requirements Ensure that a solution, or algorithm, can be developed with the information provided in the requirements Verify the user interface specifications Class 2 ~ Chapter 1 Requirements Document Class 2 ~ Chapter 1 p. 13 Phase 2 – Design the Solution Develop a logical model that illustrates the sequence of steps you will take to solve the problem Use design tools such as storyboards, class diagrams, flowcharts, and pseudocode to outline the logic of the program Class 2 ~ Chapter 1 Phase 2 – Design the Solution Class 2 ~ Chapter 1 Storyboards are sketches of the user interface Phase 2 – Design the Solution Flowcharts graphically represent the logic used to develop an algorithm Control structures allow the programmer to specify the code that will execute only if a condition is met Flowcharts use pseudocode, English, or mathematical notation inside symbols to represent the steps of a solution Class 2 ~ Chapter 1 Flowcharting symbols Class 2 ~ Chapter 1 p. 17 Class 2 ~ Chapter 1 Phase 2 – Design the Solution Class 2 ~ Chapter 1 Pseudocode is an English representation of how the program code should be written Phase 3 – Validate the Design The programmer steps through the solution with test data The user agrees that the program design solves the problem put forth in the requirements The user verifies that the initial requirements document contains all necessary requirements Class 2 ~ Chapter 1 Phase 4 – Implement the Design Write the code that translates the design into a program Create the user interface Create comments within the code that explains the purpose of the code Unit testing Class 2 ~ Chapter 1 – Test the code as it is written Test related code Class 2 ~ Chapter 1 Phase 4 – Implement the Design Phase 5 – Test the Solution Create a test plan with test cases of sample input data and expected output Perform integration testing to ensure that components interact correctly Test boundary values Document any problems Class 2 ~ Chapter 1 – If results are unsatisfactory, a new iteration of the development cycle begins Phase 6 – Document the Solution Requirements documents, program design documents, user interface documents, and documentation of the code Test cases and proof of successful completion of testing Program code should be archived electronically Class 2 ~ Chapter 1 Programming languages Class 2 ~ Chapter 1 A special language used to write computer instructions consisting of – Key Words • Words that have a special meaning • Can only be used for their inteded purpose. – Programmer-Defined Symbols • Words or names defined by the programmer Class 2 ~ Chapter 1 – Operators • Operators perform operations on one or more operands(a piece of data) – Punctuation • Punctuation characters that mark the beginning of a statement, or separate items in a list – Syntax • Rules that must be followed when constructing a program Class 2 ~ Chapter 1 Conclusion of Class 2