CS 110 Notes – Computing 1 Copyright C. Tanner 2009 Computing • Hardware o Everything goes through main memory Including things stored on disk o Types of computers Super, Mainframe, Mini, Personal • Software o Programs and Data which make computer work o Types System • Operating System o Purpose is to control hardware and users interaction with computer o Examples -- Windows, Linux • Network Software o Allows sharing of resources and communication between users • Tools o Compilers High level languages are converted to machine language 1-n Input Main Memory IRPC…etcALUCPU OUTPUT IOCS 110 Notes – Computing 2 Copyright C. Tanner 2009 o Assemblers Assembly Language programs are converted to machine language 1-1 Application Software • Allows the computer to do something specific • Uses the OS to manipulate the hardware • COTS o Commercial off the shelf o Come as is o General purpose – Word Processor, spread sheet, database, graphics, etc o Special purpose -- Communications, WWW • Special purpose –library, bookkeeping, Video Store, o Embedded -- Cash register, Microwave • Custom Built o Uses a High Level Language such as JAVA, C, C++, ADA, Basic, Prologue, SPSS, SAS, LISP etc Each has a specific grammar (rules) which must be translated by a compiler into machine language • Developing Software o Steps/Stages Understand the Problem • Determine WHAT the program must do • Determine test cases to demonstrate it does what it is supposed to do Design Solution to Problem Implement the solution in HLL • Translate the design into HLL Verify • Test and Debug • With test cases previously determined Maintain o Problem Solving Techniques Algorithm • General solution to a problem • analogies – recipe, instructions, graphics to assemble something • formal definition o a step by step procedure for solving a problem in a finite amount of time Solving by Analogy • Use as a starting pointCS 110 Notes – Computing 3 Copyright C. Tanner 2009 Means Ends Analysis • Determine the beginning and ending objectives then determine how to go from one to the other Divide and Conquer • Continually and iteratively break the problem into smaller problems (which are more manageable) Building Block/Composition • Use existing solutions for smaller problems • REUSE model Merging Solutions • Combine existing solution so as to avoid duplication • Types of Programming Language Statements o Sequential Performed (executed) in the order they appear o Selection Chooses between sets of statements based on the value of a Boolean expression o Iteration/Repetition Repeats a set of statements a number of times or until a condition is reached o Modular Creates a unit out of a set of statements which can be performed (executed) through a single name • Problem -- Mechanical Man o Statement Set Sequential • STAND • SIT • STOP • RAISE • LOWER • STEP • TURN • ADD • SUB Selection Conditions • ZERO • WALL Repetition • Repeat Until stmtsCS 110 Notes – Computing 4 Copyright C. Tanner 2009 End Repeat o Test Cases ----CS 110 Notes – Computing 5 Copyright C. Tanner 2009 • Pseudo-Code for Sequential Statements of a General Purpose Programming Language o get assign value from the user to a variable example get radius assign value given by user to the variable radius o put display value of variable to user example put “radius: “ + radius display the verbiage “radius:” followed by the value of the variable radius o = Assign variable a value Examples x =5 assigns the value 5 to variable x x = y+z*c calculates the value of y+z*c and assigns it to x • Problems o Calculate the Circumference and Area of Circle o Test Cases --CS 110 Notes – Computing 6 Copyright C. Tanner 2009 o Convert a Fahrenheit temperature to its Centigrade equivalent. o Test Cases---CS 110 Notes – Computing 7 Copyright C. Tanner 2009 o Pythagorean Triples A2 + B2 = C2 For m > n a = m2 - n2 b = 2mn c = m2 + n2 o Test Cases— o Perimeter and Area of rectangle – example 1.1 on page 19 • Steps in Developing and Executing a Program o Use text editor to enter the program source code Call it ProgramName.java o Compile the program javac ProgramName.java o repeat above until the program is error-free once error free bytecode version of program will be created • java’s machine language o combine bytecode with System utilities programs loader now ready to execute o load program into main memory interpreter translates bytecode into machine language
View Full Document