Concepts and Principles of Computer Programming
A computer (or computer system) is basically an electronic machine that can carry out specific tasks by following sequences of instructions within a program. A program includes such a sequence of instructions together data definition. The computer executes the program by performing one instruction after the other in the specified order.
The programmer needs knowledge of the basic computer architecture concepts to clearly understand the structure of computer to be able to develop solutions to problems, and to use the computer as a tool to execute the solutions to problems.
All computer systems have the fundamental functions: inpout, processing, and output.
Input involves entering data into the computer for processing. Data is entered into the computer with an input device (for example, the keyboard).
Processing executes the instructions in memory to perform some transformation and/or computation on the data in the computer's memory. This emphasizes the fact that the instructions and data must be located in memory in order for processing to proceed.
Output involves transferring data from the computer to an ouput device such as the computer screen or monitor.
What is programming?
Programming is the process of writing a sequence of instructions to be excuted by a computer to solve a problem. It is also considered as the act of writing computer programs. Computer programs are set of instructions that tell a computer to perform certain operations. The instructions in programs are logically sequenced and assembled through the act of programming. Computer programming has many facets: It is like engineering because computer programs must be carefully designed to be reliable and inexpensive to maintain. It is an art because good programs require that the programmer use the intuition and a personal sense of style. It is a literary effort because programs must be understood by computers, and this requires mastery of a programming language.
Programmers, people who write programs use different programming language to communicate instructions to the computer. The programmer begins the programming process by analyzing the problem, breaking it into manageable pieces, and developing a general solution for each piece called an algorithm. Algorithm is the instruction for solving a problem or sub-problem in a finite amount of time using a finite amount of data. An algorithm is a verbal or written description of a logical sequence of actions applied to objects.
Suppose a programmer needs an algorithm to determine an employee's weekly wages. The algrorithm reflects whatwould be done by hand:
1. Look up the employee's pay rate.
2. Determine the hours worked during the week.
3. if the number of hours worked is less than or equal to 40, multiply the hours by the pay rate to calculate regular wages.
4. If the number of hours work is greater than 40, multiply 40 by the pay rate to calculate regular wages, and then multiply the difference between the hours worked and 40 by 1 1/2 time the pay rate to calculate overtime wages.
5. Add the regular wages to the overtime wages (if any) to determine total wages for the week.