Chapter O Introduction Prelude to Programming PEG Abacus uses rows of sliding beads to perform arithmetic operations and has root that data back more than 5,000 years to ancient Babylonian. A computer is a mechanical or electronic device that can efficiently store, retrieve, and manipulate large amounts of information at high speed and with great accuracy. It can execute task and act without human interaction by carrying out a list of instructions called a program. Charles Babbage an Englishman, designed and partially built a true computer In the mid asses called analytical engine could process 40 dealt numbers.
MANIAC or Electronic Numerical Integrator and Computer build by Presser Kicker and John Macaulay was a huge machine 80 feet long and 8 feet high, Weighed 33 tons and contained over ASK vacuum tubes in its electronic circuits and consumed KICK watts of electricity. It could perform K additions per second . PEG PC or personal computer Introduced In 1974, thanks to the Invention of microchip, a piece of silicon packed with thousands of electronic components and the microprocessor. PEG 7 The internet is a worldwide collection of networks.
Don’t waste your time!
Order your assignment!
A network consist of two or more inked computers that are able to share resources and data via cable or phone lines. Internet has roots that data back to a small U. S. Defense Department project in the late asses. The worldwide web originated in 1989. Web 2. 0 consist of web applications that facilitate information sharing, user centered design and collaboration. Web 2. 0 it is not an update or change in technical specifications, but rather change the way people use the web. PEG 8 CPU, Internal memory, mass storage devices are located In the system unit.
Input and output devices are housed in the own enclosures or sometimes called reprisals. Instruction, performs the arithmetic and logical operations necessary to execute them and controls the other computer components. CAP], transistors are plugged in to the main circuit board or motherboard. ROOM Read Only Memory contains unalterable set of instructions used for computer boot up process. RAM or Random access memory can be read from and written to. The smallest unit of memory is the bit. A bit can only store a zero or a one.
Operating System has two essential functions: It helps applications communicate with the computer hardware. Provides an interface between user and the computer. Programming Language is a set of symbols and the rules governing their use that are used in constructing program. There are three fundamental types of programming languages: Machine Languages Assembly Languages High-level Languages Machine Language is a sequence of bits. Each combination of bits is an instruction to the computer about something. Machine language is the only language computers can understand.
It is difficult for humans to read or write machine language programs. For this reason, programmers normally use either assembly or high-level languages. Assembly Language symbolic representation of machine language. Each assembly language instruction translates into one machine language instruction. However Assembly language uses recognizable codes, lot easier for people to understand. Assembler translates Assembly language to Machine Language. High-Level languages usually contain English words and phrases. Their symbols and structure are far removed from those of machine language.
Easily to learn and use and the resulting of programs are easier to read and modify. A single instruction in high level language usually translates into many machine instructions. FORTRAN was the first high-level language developed in mid asses, primarily for engineering and scientific applications. C++ is currently one of the most popular languages. It is used for efficient programming of many different types of applications. COBOL (Common Business Oriented Language) JAVA very popular language used for web applications. Visual Basic a new version of BASIC.
Runs on graphical user interfaces. PAGE To write a program you need a set of programs text editor, debugger helps find error in a program, a compiler or interpreter helps translate program to machine language. Chapter 1 Introduction to Programming PEG 25 What is programming? General Problem-solving strategy: Understand the problem. Do research and ask question about the problem. Devise a plan of action. Create a precise list of steps of things to do to resolve the problem. Carry Out your plan. Execute each step you planned. Review the results. Once, performed the listed tasks.
Check to see that the information is correct. Revise every detail. We say problem-solving is a cyclic process because we often return to the beginning or redo previous work before arriving at a satisfactory solution. PEG 26 Creating Computer Programs: Analyze the problem. Determine what information you are given. What results you need to get, what information you need to get those results, and in general terms, how to proceed from the known data to the results. Design a problem to solve the problem. This is the heart of the development process. Code the program.
Write computer code in a computer language that implement step 2. Test the program. Run the program to see if it solves the problem. PEG 27 Basic Programming Concepts Project to figure out how many songs you can buy for long plane ride to Paris. Notions of Data Input Constants Variables Concepts of Processing Output Types of Data. The numbers, words, or collection of symbols that is manipulated by a program. PEG 28 Simple Program Calculator to perform to calculate the cost: Enter the number of songs to be purchased into the calculator. Press the multiple (x) key.
Enter 0. 99 Press the equals (z) key. The total cost will appear in the display PEG 29 Computer program statements to calculate the cost Input the number of songs you wish to download Today: Songs Compute the cost of the purchase: Set Dielectric = 0. 99 * Songs Set of statements shown above are known as pseudopodia. Computer programs are written in programming languages and follow and exact Syntax. The Syntax of a computer language is its rules of usage. PAGE pseudopodia uses the word Write “Enter Message”to display messages and other information in the screen. Scudded uses statement Input to allow the user to enter data. PEG 32 Variable is used to store data. It’s quantity can change value during the execution of program. Constant a value that cannot be changed during the program execution; When a constant gets a name it is called a Named constant. X. Dielectric = 0. 99 PEG 33 Variable Names rules: All variable names must be one word. Underscores are allowed and hyphens are usually allowed, but spaces are never allowed. Variable names can be long; in fact, many languages allow more than 200 characters.
Use uppercase letters to distinguish one word from another. Most languages allow numbers to be part of variable names, but variable names should never start with a number. Make sure Variable names are meaningful. PEG 34 Set Statement assigns the value of the expression on the right of the equals sign to he variable or also known as assignment statement. PEG 36 All programming languages use at least four basic arithmetic operators-addition, subtraction, multiplication, and division. Some languages contain other arithmetic operators, such as exponentiation (taking a number to a power) and modulus.
The modulus operator may seem odd at first, but as you start to write programs you remainder after diving one number by another. PAGE Hierarchy of Operations the order arithmetic operations are performed is as follows: Perform the operation in parentheses (from the inside out, of there are parentheses thin parentheses) Perform exponentiations Do multiplications, divisions, and modulus (from left to right if there is more than one) Do additions and subtractions (from left to right if there is more than one) Computer will always apply the hierarchy of operations to any mathematical expression in a program.
PEG 43 Character string (or string) is a sequence of characters. Declare Statement. Used to declare a variable. Ex. Declare Variableness As Database PEG 44 Postcode uses Character state for non numeric data. Ex. Declare Response as Character. Must programming languages include at least one string operator, concatenation, which takes two strings and Joins them to produce a string result. For example, if Strings= “Part” and Strings = “Time”, then the statement.
PEG 46 Integer Data Most programming languages allow at least two types of numeric data to be used in programs: integers and floating point numbers. Integer data consist of all the whole numbers, negative, zero and positive. Floating point number data consist of all number that include a decimal part. Declaring an Integer statement Declare number As Integer Declaring an floating point number