290 likes | 458 Views
ITD1011- Introduction to IT. جـامعـــة الـجــزيــرة. UNIVERSITY OF JAZEERA. Dr. Mohamed Sammouda. Problem Solving and Computer Language. Chapter 5. Problem Solving using Computer. Steps Understanding of the problem ? Methods and Logic to solve the problem.
E N D
ITD1011- Introduction to IT جـامعـــة الـجــزيــرة UNIVERSITY OF JAZEERA Dr. Mohamed Sammouda
Problem Solving and Computer Language Chapter 5
Problem Solving using Computer Steps Understanding of the problem ? Methods and Logic to solve the problem. Flow-Chart /Algorithm / Decision Tables / Pseudo Code. Computer language ? Coding ? (Programming) Execution and producing the results.
Steps Understanding of the problem :- Problem should be clear to us. We should know, what is given ? What is to be done ? Methods and Logic to solve the problem : We should know how to solve the problem. If we don’t know the method and logic to solve the problem, the computer can’t help.
The computer can do only five operations : Additions Substractions Multiplications Divisions Compare The computer can do these calculation at very high speed.
3- Algorithm: an algorithm is an effective method for solving a problem using a finite sequence of instructions. Algorithms are used for calculation, data processing, and many other fields. - An algorithm is a step-by-step problem-solving procedure, especially an established, recursive computational procedure for solving a problem in a finite number of steps. An algorhthm is a step-by-step procedure for getting something done. A good example of an algorithm is a recipe. What is an ALGORITHM?
You execute another algorithm called go-to-the-store. that algorithm goes something like this: Walk from [your kitchen] to [your car]. Drive to [your local store]. Walk from [your car] into [your local store]. For each [listing] in [your shopping list]: Find an [item] which matches [listing]. Put [item] into [your basket]. Pay for everything in [your basket]. Walk from [your local store] to [your car]. Get into [your car]. Drive to [your house]. Get out of [your car]. Walk from [your car] into [your kitchen]. What is an ALGORITHM?
4. Computer Language : Why we need computer language ? Because, computer understands only the computer language, the computer don’t understand our languages like English, Hindi, Punjabi etc. So we have to give instructions in one of the computer languages ? Program – Instructions written in computer language.
Types of Computer Languages :- Low – level languages High – level languages Data Base languages
Low-level languages – Historically Low-level languages were developed first. Low – level languages are machine dependent. The low-level languages vary from machine to machine. If one learns and works on one machine, after changing the computer, one has to learn again new language for the new machine. That is why the computer remains with the manufactures or with the universities and with the research institutes. Low – level languages are of two types Machine languages Assembly languages
a) Machine language : Strings of numbers giving specific instructions. Example : + 1300042774 + 1450212674 + 1303245574 These codes vary from machine to machine. Learning of the machine language is difficult.
b) Assembly Language : (Symbolic Language) Instead of numeric code, some symbols are used. Examples : LOAD BASEPAY ADD OVERPAY STORE GROSSPAY Symbols also vary from machine to machine.
B) High Level Languages : High Level languages are machine independent. These are more near to our problems. Easy to learn and with less time. We can learn anyone high level language and that will work on any computer of any company in any part of the world.
The various High – Level Languages are :- BASIC – Beginners All Purpose Symbolic Instruction Code FORTRAN – Formula Translation COBOL – Common Business Oriented Language PASCAL – Named after Blaisé Pascal C – The latest and most powerful language.
TRANSLATORS Actual Processing is done in only in machine languages. All Assembly language and High level language programs have to be translated into the machine language of that particular machine.
Translators are provided by the manufacturers. There are three types of translators Assembler Interpreter Compiler Translator first finds the grammatical mistakes and if there is no grammatical mistake then translate it into the machine language.
i) Assembler : Assembler translates only the assembly language program into the machine language. ii) Interpreter : Check and translate the high – level language programs into the machine language line by line. Interpreter is available only for BASIC language iii) Compiler : Reads the whole high – level program, if there is no grammatical error, then it translates the whole program into the machine language.
Source Code : Program written in High- level languages. Object Code : Translated program in machine language from high level languages. There are two types of Errors i) Syntax Errors ii) Logic Errors
Syntax Errors : Every computer language has its own grammer and the rules of the language. If the program is not according to the rules of the language, those errors are called Syntax errors (Grammatical Errors). Syntax Errors are easy to detect and easy to remove.
Logic Errors – If there is no Syntax error, still program may or may not work. If our method or logic is wrong, the program won’t work (GIGO). eg. - Diversion by zero. - Square root of negative numbers. - Number out of range, etc.
5. Execution and Results :- Object Program + Data Results Actual processing is done with the object program. Any change or correction in the problem, has to be made first in the source program, then source program is translated into the object program. No direct change in the object program.
If some logic error is there, you may not get the result. You have to first correct logic and then make the necessary correction in the source program and then translated into the object program and finally execution.
C) Data Base Languages : DBASE-III, IV FOXPRO ORACLE
Data Base Languages are : - Easy to use - Much simpler - Popular among non-professional - Learning with less time - Language as well as package
Language – Database languages have all the features of high-level languages. Package – Database languages have some command to do some jobs. Commands can be used directly and there is no need of any programming. Other packages are : - MS-WORD - MS-EXCEL - MS-ACCESS
What is Data Base ? Characters - A – Z, 0 – 9 Special Characters (Any character on the key board) Field / Data item- Collecting of Characters Record - Collection of Data items File - Collection of Records Data Base - Collection of Files
Example – Data Base of Students : Data Base Structure : Field NameTypeWidth NAME Character 20 D-O-B Date 8 Address Character 30 City Character 15 PIN Numeric 6
Example of Data Base : Student NAME D-O-B ADDRESS CITY PIN 1. RAM 15/10/93 145/Sec. – 15 Chandigarh 160015 2. SHAM 10/05/92 165/Sec.- 19 Chandigarh 160019 3. SITA 10/06/93 989/Sec.- 45 Chandigarh 160045
Facilities available in Database Languages Creation of Data Base and Data-Base Structure Entering the Data Records Editing the Data Records Adding New Records Deleting Records Retrieving and Searching the records Displaying the records Preparing the reports Quarries Sorting etc.