CS 110 Notes Computing 1 Computing Hardware ALU CPU Input Main Memory IR PC OUTPUT etc IO 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 Copyright C Tanner 2010 CS 110 Notes Computing 2 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 point Copyright C Tanner 2010 CS 110 Notes Computing 3 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 Instruction Set Sequential STAND SIT STOP RAISE LOWER STEP TURN ADD SUB Selection Conditions ZERO WALL Repetition Repeat Until stmts Copyright C Tanner 2010 CS 110 Notes Computing End Repeat o Test Cases Copyright C Tanner 2010 4 CS 110 Notes Computing Pseudo Code for Sequential Statements of a General Purpose Programming Language o get o o assign value from the user to a variable example get radius assign value given by user to the variable radius put display value of variable to user example put radius radius display the verbiage radius followed by the value of the variable radius 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 Copyright C Tanner 2010 5 CS 110 Notes Computing o Convert a Centigrade temperature to its Fahrenheit equivalent o Test Cases Copyright C Tanner 2010 6 CS 110 Notes Computing o o Pythagorean Triples A2 B2 C2 For m n a m2 n2 b 2mn c m2 n2 Test Cases Copyright C Tanner 2010 7 CS 110 Notes Computing 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 JVM Copyright C Tanner 2010 8
View Full Document
Unlocking...