Ch1

Click here to load reader

download Ch1

of 46

Transcript of Ch1

  • 1. CS1040: Introduction to Problem Solving & Programming Summer 2013 Instructor: Malik Tubaishat 1 University of Missouri

2. Break the ice 2 3. Name/Nickname Major Hobbies Summer Plans Brag Speakers Circle 3 4. Bio http://web.missouri.edu/~mma4n6/ PhD student in Computer Science Lab: MU Center for High Assurance Computing Research: Wireless Sensor Network and Reinforcement Learning emphasis on Traffic Engineering Machine Learning and Binary Code Analysis emphasis on Malware Detection 4 5. Course Website & Blackboard Course website: http://babbage.cs.missouri.edu/~mma4n6/ Course Info, slides, assignments, class notes, etc. Blackboard: https://bblearn.missouri.edu/ We will use BB for lab assignments submission only. 5 6. Exam dates are fixed!6 7. My Office EBN 322 Office hours: by appointment Email: [email protected] 8. My Office EBN 322 Office hours: by appointment Email: [email protected] 9. Useful Links 9 Division of Information Technology Computing Sites: locations, hours, etc. Request a Bengal Account University of Missouri MSDNAA (for students enrolled in CS courses only) Download Visual Basic Express 2010 10. http://msdn08.e-academy.com/elms/Storefront/Home.aspx?campus=missouri_coms10 11. Questions? Break! 11 12. 1.1 An Introduction to Computers 1.2 Windows, Folders, and Files 1.3 Program Development12 Chapter 1: An Introduction to Computers & Problem Solving 13. 1.1 An Introduction to Computers Computers Programming languages (machine, Assembly, higher-level) Software Hardware Compiler Operating System 13 14. 1.1 An Introduction to Computers Computers Why do we use computers? Components (Hardware)? Storage units (RAM, ROM, ) 14 15. Storage Units 15 RAM Random Access Memory ROM Read Only Memory Hard Disk USB Flash Drive SD Card Secure Digital Card ??? 5 4 1 2 3 16. 1.1 An Introduction to Computers 16 Computers Why do we use computers? Components? (Monitor, Motherboard, CPU, RAM, Expansion cards, Power supply, Optical disc drive, Hard disk drive, Keyboard, Mouse) Storage units (RAM, ROM, ) 17. 1.1 An Introduction to Computers 17 What is a computer program? A set of instructions We use a programming language to write those instructions Programming languages Machine Assembly High-level 18. Programming languages 18 19. 19 Programming Languages Machine Language (Low-level language) Assembly Language (Low-level language) High Level Language (example ?) 1001100101010011 1001101001101010 ADD R1,R2 MVR R2,R12 pay = hours * wage; A: 01000001 (bin.) 65 (dec.) a: 01100001 (bin.) 97 (dec.) 32-bit and 64-bit? Bit and Byte? 19 20. 1.1 An Introduction to Computers 20 Programming languages (machine, Assembly, higher-level) Software Compiler/Interpreter Operating System Andriod, iOS ??? 21. Chapter 1 21 1.1 An Introduction to Computers 1.2 Windows, Folders, and Files 1.3 Program Development Cycle 1.4 Programming Tools 22. 1.2 Windows, Folders, and Files 22 23. 1.2 Windows, Folders, and Files 23 File and Filename File extension Folder and Subfolder Path Drive name 24. Chapter 1 24 1.1 An Introduction to Computers 1.2 Windows, Folders, and Files 1.3 Program Development Cycle 1.4 Programming Tools 25. 1.3 Program Development Cycle 25 How to solve a problem by writing code? Determine Output Determine Input Determine Process 26. 1.3 Program Development Cycle 26 Problem: Calculate the average temperature for the first week of June. 27. 1.3 Program Development Cycle 27 Problem: Calculate the average temperature for the first week of June. Output: Input: Process: 28. 1.3 Program Development Cycle 28 Problem: Calculate the average temperature for the first week of June. Output: average temperature Input: Process: 29. 1.3 Program Development Cycle 29 Problem: Calculate the average temperature for the first week of June. Output: average temperature Input: t1, t2, , t7 Process: 30. 1.3 Program Development Cycle 30 Problem: Calculate the average temperature for the first week of June. Output: average temperature Input: t1, t2, , t7 Process: 7 7 1i it 31. 1.3 Program Development Cycle 1. Analyze: Define the problem. Understand the problem Ask questions What the output should be What data (or input) are given 31 32. 32 2. Design: Plan the solution to the problem. Build a logical sequence of steps (Algorithm) Test the logic of the steps by using different data inputs 3. Design the interface: Build GUI (text boxes, buttons, etc.). 4. Code: Translate the algorithm into a programming language. (e.g., 1.3 Program Development Cycle 32 33. 5. Test and debug: Locate and remove any errors (bugs) in the program. Compiler helps debug program Syntax and semantic errors misspelling or incorrect placement of words Run-time errors program halts Logic errors program produces incorrect output 1.3 Program Development Cycle 33 34. 6. Complete the documentation: Organize all the materials that describe the program. 1.3 Program Development Cycle 34 35. 1.4 Programming Tools Pseudocode algorithmic steps using English- like phrases & a programming language terms to outline a task Flowcharts graphical method to show logical steps 35 36. 1.4 Programming Tools Pseudocode algorithmic steps using English-like phrases & a programming language terms to outline a task Example: Find the average temperature of a week 1. Input one temperature 2. Add temperature to total (total = total + temperature) 3. Go to step 1 4. Average = total / 7 36 37. Flowchart Symbols (page 9) 37 38. 38 Flowchart Example How fast is a car traveling if it goes 50 miles in 2 hours? 38 39. Program Structure Three main structures for all modern languages Sequence Selection (or decision structure) Repetition (or loop structure) 39 40. Program Structure Sequential Selection Repetition 40 41. 41 I) Sequence 41 42. 42 II) Decision/Selection If Time