Presentation is loading. Please wait.

Presentation is loading. Please wait.

Intro to Programming & Algorithm Design

Similar presentations


Presentation on theme: "Intro to Programming & Algorithm Design"— Presentation transcript:

1 Intro to Programming & Algorithm Design
9/8/2018 Intro to Programming & Algorithm Design Overview This presentation can be viewed on line in a file named: Copyright 2017 by Janson Industries

2 Objectives Explain Steps to success in this class
9/8/2018 Objectives Explain Steps to success in this class Basic computer concepts Basic programming concepts Computer hardware

3 PP Presentations Can be viewed on line or downloaded
9/8/2018 PP Presentations Can be viewed on line or downloaded For all presentations and class files, go to:

4 This presentation is ch01.IntrotoProg (scroll to bottom)
Click the file name … Chapter 1 © copyright Janson Industries 2017

5 … select Open (to view) or Save as (to download)
Chapter 1 © copyright Janson Industries 2017

6 If "Save as" selected, specify where to save to
Chapter 1 © copyright Janson Industries 2017

7 Class Success Read text before coming to class
9/8/2018 Class Success Read text before coming to class In class take good notes Suggestion: print out PP and use as basis for notes Will need a thumb/flash drive Organize your work. Pay attention to file: Name Location

8 9/8/2018 Class Format For each chapter there will be a lecture with an associated PP Will cover the same material as the chapter but with alternative examples Then non-graded and graded labs will be assigned

9 9/8/2018 Class Format Labs can be found on the class website in a folder called Labs Then in a subfolder named C#, where # is the chapter number Most labs are in Word documents that follow the naming convention of Chapter # Lab.COP1000.doc Where # is the chapter number

10

11 Many of the labs have videos If you want to view, download these also

12 9/8/2018 Class Format You must do the non-graded assgs to get credit for the graded assgs NG assgs broken up into several pieces Turn in each NG assg piece one at a time and I will send the solution/feedback Then tackle the next piece

13 Each lab has a short review of the topic(s) and detailed instructions.

14 Then questions for you to answer and submit
I will give you feedback/corrections so you can do the next lab

15 Then the next lab

16 9/8/2018 Labs/Assgs The last lab is usually the graded assg and will be clearly marked as such For text assgs you can either Change the lab document and submit Create a new doc and submit

17 Example of the program output
Explanation of the lab Example of the program output

18 Deliverables

19 9/8/2018 Turning In Assgs When submitting the lab document via , delete the video links If you don't, the file will be too large and the system won't send it And, often, not tell you that it wasn't sent When I get any lab file, I will send a short reply indicating I got it If you don't get a reply, I didn't get it and you must resend

20 Responsibility To do the labs you will have to understand the material
9/8/2018 Responsibility To do the labs you will have to understand the material You will not learn the material sitting in class listening to a lecture Lecture is like a shower Most of the knowledge goes down the drain You will have to read the text, do the labs/examples, and study!

21 Responsibility All labs due at 11:59 pm on the due date
9/8/2018 Responsibility All labs due at 11:59 pm on the due date I’m a real stickler for on time work No late work accepted You should have read the text and started the lab before you come to the lecture (or read the PPs) You will better understand the lecture and ask better questions about the labs

22 Concepts Computer Hardware (h/w): the computer machinery
9/8/2018 Computer Electronic device that processes data into information according to specific instructions Hardware (h/w): the computer machinery Software (s/w): group of instructions that enable the h/w to work Like a recipe

23 Concepts Information processing cycle
Computer can store input and output Input Output Processing Storage

24 Concepts Input comes in two forms: Output is information
9/8/2018 Concepts Input comes in two forms: Data: raw facts Can be text, numbers, images, etc. Instructions Click on a button/icon, type a command Software Output is information Useful/meaningful knowledge

25 Concepts Computer Hardware Input Device Keyboard Microphone Scanner
Mouse Output Device Printer Monitor Speakers Input Input Output Output Processing CPU Storage Device Hard drive Thumb drive CD/DVD drive Memory cards

26 Concepts - Storage Computer can hold data/information
9/8/2018 Concepts - Storage Computer can hold data/information All data (pictures, music, video, etc.) stored as a series of zeroes and ones Different systems for storing different types of data ASCII, Unicode for character data Binary, packed decimal for numbers mp3, wav for audio jpeg, gif for images

27 Lots of Different Storage Types
9/8/2018 External vs. Internal Storage Internal also called Main Memory or RAM Many differences between the two Speed, capacity, persistence Volatile vs. nonvolatile Key difference is, that MM managed by CPU External memory has a separate device that manages the media

28 Concepts External storage examples Internal storage examples Hard disk
9/8/2018 Concepts External storage examples Hard disk Memory stick CD/DVD Internal storage examples RAM ROM VRAM

29 Concepts - Storage Secondary storage measured in Gigabytes/Terabytes
9/8/2018 Concepts - Storage Secondary storage measured in Gigabytes/Terabytes Internal storage measured in Megabytes/Gigabytes Of course this begs the question: "What's a byte?" Gather round while I tell you the story of Snow White and the seven dwarves…

30 Concepts - Storage 9/8/2018 Numbers are different, this binary number: Is the equivalent of 91 (in base 10) In binary, each digit is a power of 2 Just like in decimal (base 10) where each digit is a power of 10 So in base 10, 254 represents: 2 groups of 100 (10 to the second power) 5 groups of 10 (10 to the first power) 4 groups of 1 (10 to the zero power)

31 Concepts - Storage So 0 1 0 1 1 0 1 1 represents
9/8/2018 So represents 0 groups of 128 (2 to the 7th) 1 group of 64 (2 to the 6th) 0 groups of 32 (2 to the 5th) 1 group of 16 (2 to the 4th) 1 group of 8 (2 to the 3rd) 0 groups of 4 (2 to the 2nd) 1 group of 2 (2 to the 1st) 1 group of 1 (2 to the zero) = 91

32 Concepts Software Two types of software
9/8/2018 Concepts Software Instructions that the computer (CPU) executes to transform the input into output Two types of software Systems Enables the computer to function/run more efficiently Application Performs functions the user wants

33 Concepts Systems Software Operating systems Utility programs
9/8/2018 Concepts Systems Software Operating systems Windows, Mac OS, Linux Utility programs Zip, RAR/MP3 converter Programming language translators Assemblers, Compilers, Interpreters More on these a little later

34 Concepts Application s/w categories
9/8/2018 Application s/w categories Efficiency Entertainment Education An application (app) consists of both s/w and data An app’s s/w is broken up into pieces called programs An app can be comprised of 100’s even 1000’s of programs

35 Concepts How programs, internal and external storage work together
Internal memory Aka RAM 1 Run Program Input Device Run Program 3 Copy of Program CPU 2 Copy of Program External memory Storage Device

36 9/8/2018 How Programs Work Once program is in MM, CPU reads and executes one instruction at time // OilCalc.java import java.io.*; public class OilCalc { public static void main(String[] args) throws IOException { BufferedReader dataIn = new BufferedReader(new InputStreamReader (System.in)); int amount = 0; double cost = 0; String amtString = ""; System.out.print("Amount of oil is? "); amtString = dataIn.readLine(); amount = Integer.parseInt(amtString); if (amount <= 100) {cost = amount * 2.25;} else if (amount <= 250) { cost = 100 * (amount-100) * 2.10;} else { cost = 100 * * (amount-250) * 1.99;} System.out.println("The cost of the oil is $" + cost); }

37 Programming Concepts Machine Language Problems with Machine Language?
9/8/2018 Programming Concepts Machine Language 0's and 1's the computer can execute Problems with Machine Language? Hard for humans to understand and write Easy to make mistakes, takes a long time to type First improvement Assembly level languages

38 9/8/2018 Programming Concepts Assembly level languages short commands/acronyms rather than zeroes and ones Mul means multiply the numbers in locations 30 and 18 and store the result in location 16 Mov means move the number in location 24 to location 32 Out 14 means display the value in location 14

39 9/8/2018 Programming Concepts Assembly level language must be converted into machine language A piece of s/w called an Assembler converts Assembly level language into machine language Like s/w that converts a rar to an mp3 Problem with Assembly level languages Programmer has to manage internal memory

40 Programming Concepts High Level Languages (HLL)
9/8/2018 Programming Concepts High Level Languages (HLL) English like commands Strict syntax Like grammar in a spoken language HLL must also be converted into machine language 2 types of S/W to translate HLL to machine language: Compiler Interpreter

41 Programming Concepts Source Code file Machine Language file CPU Editor
HLL source code Machine language Editor Compiler OS HLL source code Translate command Run command Programmer Programmer User

42 Programming Concepts Source Code file CPU Editor Interpreter
HLL source code Machine language Editor Interpreter HLL source code Run command Programmer Programmer

43 Programming Concepts Lots of different HLLs
Each language has advs/disadvs C and VB great for PC based apps COBOL good for business apps Fortran good for scientific apps Java good for PC/Server/Mobile apps

44 Programming Environment
9/8/2018 Programming Environment Before any source code is written, the programmer/analyst creates a program design Primary designs are flow chart diagrams and pseudo code When designing, use tools (software) to generate flow chart diagrams and pseudo code

45 Programming Environment
9/8/2018 Programming Environment When programming use an IDE (Integrated Development Environment) At a minimum an IDE will have a source code editor A source code editor is to a program what word processing software is to a document

46 Notepad++ is an example of a simple source code editor
9/8/2018 Let’s a programmer enter, change and save source code

47 IDE Source code editors will have many more capabilities
9/8/2018 IDE Source code editors will have many more capabilities Show syntax errors Format code for readability Code completion Finish a statement Add necessary tokens (semicolons, parenthesis, etc.)

48 IDE Will also have other tools/functions
9/8/2018 IDE Will also have other tools/functions Compiler(s) – support for many languages Debugger – s/w that Traces statement execution Can temporarily halt program execution and allow programmers to display program data Test environment Programmer can run program and see results

49 Area to see program results
Colors indicate static text, types of statements, language keywords, etc. Error indicators Area to see program results Lots of IDEs: RAD(IBM), Visual Studio(Microsoft, doesn’t support Java), NetBeans(Open source/Oracle), Eclipse(Open source/IBM)

50 A Visual Editor lets you click and drag GUI components.
It generates the code!

51 Alternative Resource Code.org
9/8/2018 Alternative Resource Code.org Uses videos and games to get across the basic programming structures which will be covered over the next months

52 You can skip the video and go straight to the instructions
Once done with instruction, close window and try exercises

53 The first puzzle will start

54 There may be more instructions, click X's to close
When puzzle finished will allow you to continue to the next one or you can click to skip ahead There may be more instructions, click X's to close

55 Click Continue to go to next puzzle

56 Click Continue to go to next puzzle

57 If you can't figure it out, scroll down and click the help links

58 9/8/2018 Code.org I strongly recommend that you go through all twenty puzzles over the next 3 weeks They will greatly help you understand the concepts of Alogorithms Sequential processing Selection Iteration

59 How Class Works There's an entire COP1000 set of lessons at
9/8/2018 How Class Works There's an entire COP1000 set of lessons at

60 Unplugged activities have the theory – good to read first
Then tackle the puzzles

61 Points to Remember Four major computer operations: Input Processing
9/8/2018 Points to Remember Four major computer operations: Input Processing Output Storage

62 9/8/2018 Points to Remember Everything in the computer stored as zeroes and ones Pictures, numbers, sounds Two types of software Systems Application

63 Points to Remember Programs are written in a programming language
9/8/2018 Points to Remember Programs are written in a programming language Referred to as source code Source code must be translated into machine language Machine language can be executed, source code cannot be executed

64 9/8/2018 Points to Remember Programmers have lots of s/w tools to help design and code programs Bring your thumb/flash drives to the next class


Download ppt "Intro to Programming & Algorithm Design"

Similar presentations


Ads by Google