Presentation is loading. Please wait.

Presentation is loading. Please wait.

Computer Science-I (CSIT121) Dr. Junaid Ahmed Zubairi SUNY Fredonia Room 210, Fenton X-4694,

Similar presentations


Presentation on theme: "Computer Science-I (CSIT121) Dr. Junaid Ahmed Zubairi SUNY Fredonia Room 210, Fenton X-4694,"— Presentation transcript:

1

2 Computer Science-I (CSIT121) Dr. Junaid Ahmed Zubairi SUNY College @ Fredonia Room 210, Fenton X-4694, zubairi@cs.fredonia.edu

3 Introduction n In this course, we learn how to use the computer effectively to solve problems n Let us go over the syllabus and then start the introductory topics.

4 Syllabus n Textbook: Programming and Problem Solving With C++, 2 nd Edition, Nell Dale, Chip Weems and Mark Headington, Jones and Bartlett 2000 n Grading System: F Assigned Works40% F Exam-I30% F Exam-II30%

5 Topics F Introduction to Computers F Overview of C++ F Top Down Design F Selection F Repetition F Function Arguments F Formatting and Files F Arrays and Structures F User defined classes F Recursion

6 Introducing Computers n A computer is a device capable of performing computations n What is the difference between a calculator and a computer? n Answer: Taking Logical Decisions n Example: if Result=0 then R1 <= R2*R3-5; else R1 <= R2

7 History of Computers n 2000BC Abacus used for computations n 1890 Hollerith designs electronic census reader and later founds IBM n 1939 J. Atanasoff designs first electronic digital computer n 1946 Von Neumann proposes stored program computer n 1977 Apple Computer launched n 1981 IBM PC launched

8 History of Computers n 1970 UNIX first version released n 1971 Pascal language developed n 1972 C language developed n 1973 Part of UNIX implemented in C n 1985 C re-implemented as C++ n 1996 C++ standard released

9 Types of Computers n Microcomputers (PDA, Lap-top, Desk-top and Workstation computers) n Minicomputers and Mainframes n Supercomputers

10 Hardware of Computers n Computers consist of Y CPU Y Memory (Primary/Secondary) Y Input devices Y Output devices n What is a floppy drive? n What is a SIMM? n What is a modem?

11 Inside The Computer INPUTOUTPUT MEMORY CPU

12 CPU Operation n CPU is the brain of the computer n It coordinates all operations and performs specified instructions n It has to bring the instructions from main memory (fetch) n It executes the current instruction as specified (execute) n It stores the results in memory if required

13 Memory Operation n Memory consists of storage cells that are numbered n Computer can store and retrieve values in memory by addressing the cells and setting bits n A cell may consist of 8 bits in which case it is called a Byte n A bit can only have value 0 or 1.

14 Types of Memory n Main Memory consists of RAM and ROM. n ROM stores permanent settings for the computer. n RAM stores user programs temporarily when the programs are being executed n A user program cannot run if it is not loaded into RAM

15 Types of Memory n Secondary Memory consists of Hard disks, floppy disks, CD- ROMS, DVD’s, and tapes etc. n Hard disks contain the operating system of the computer and the user programs and data files. n Floppy disks are removable n Tapes are used for backup n CD-ROMS distribute software

16 Input/Output Devices n A keyboard is the most important input device. n Can you identify the most important output device? n Some non-traditional computers require other I/O devices such as control panels, digital displays n What is a NIC?

17 Programming the Computer n Computer speaks ‘1’ and ‘0’ n Lowest level programming language is the machine language it uses Hex or mnemonics to convey 1’s and 0’s to the computer n 0x2004=0010 0000 0000 0100 n A high-level language would resemble human-language n if price > my_limit then don’t_buy

18 High Level to Low Level Languages C++ Program My_var = this_data+next_data Compilation and Linking 0001010100111111//Load R5 from Memory 0001010000111110//Load R4 from Memory 0110011001010100//Add R4,R5 & store result in R6 0011011000111101//Store R6 into Memory

19 High Level languages n Some high level languages include FORTRAN (Engineering and Science), COBOL (Business), Pascal (Instructional), Lisp (AI), C++, Java (General). n Programs written in these languages are finally translated to ‘1’s and ‘0’s before being executed

20 A Program’s Stages From Source to Execute Source File CompilerObject File Linker/ Loader Executable File

21 Sections of Programs n A program running in the computer would have n data input instructions u e.g. read (price, my_limit) n data manipulation instructions u e.g. is price > my_limit? n data output instructions u e.g. write (don’t_buy)

22 A Problem Solving Strategy n Assume that you have a problem to be solved on computer n Think about the problem specification and identify I/O n Plan on program design with data design and procedural design n Implement the program n Test and debug the program

23 NiMo’s varying rates n Example: Niagara Mohawk wants to apply different rates to its customers. If the customer burns more than 1000 units in a month, rate B is applied else rate A is applied. You need to develop a software function that can give the total charges as output given a customer’s consumption.

24 NiMo’s varying rates n You develop the data model for this problem n What is the input to your function? n Answer: consumption, A, B n What is the output? n Answer: charges n What formula to be used? n Answer (A or B)*consumption

25 Top Down Design n If you are given a complex problem, you are better off dividing it into sub-problems n Target is to let each sub-problem deal with one aspect of the software n Thus you can rapidly develop the software to solve complex problems

26 NiMo’s varying rates n In our example, the program can be divided into three sections: n Answer: Input, processing, output n Write a code segment to get the rates n Write a code segment to process the charges n Write a code segment to output the charges

27 Algorithm Development n Once given a problem, you need to develop an algorithm to solve it n An algorithm is a series of steps needed in a certain order to solve a problem n Algorithm refinement is done to break it into smaller modules n Desk check is done to make sure it will indeed solve the problem

28 Software Testing n Once you have coded the program, you should test it to make sure it works n Testing is related to the requirements developed in problem analysis phase n Testing is exhaustive n Testing is a specialized field

29 Documentation n When you develop a program, make sure that you document it properly n Documentation consists mainly of n User Guide n Administrator Guide n Comments in the source code n Description of strategy

30 Maintenance n A program being used requires maintenance over a period of time n What are the reasons for maintenance? n Answer: Bug discovery, finding out some limitations, future expansion of requirements n Example: yy or yyyy for year tracking

31 Structured Programming n Structured programming calls for Top Down modular design n Each module can be refined further until single-minded modules are achieved n Sharing of data among modules should be reduced to avoid confusion during debugging

32 Object Oriented Programming n An object is a data and procedural abstraction n data represents attributes n procedures represent behavior n OOP hides attributes and behavior in classes n Classes are used as templates to create objects

33 Think about Objects n We find objects everywhere!! n A table is an object n Table’s attributes include its height, width, material used etc. n Table’s behavior includes its usage. For example, you can study on a table or eat on a table but you cannot travel on a table!!

34 Think about Objects n A car is an object n The attributes of a car include its make, model, color, number of seats etc. n The behavior of a car includes stopping on applying brake, accelerating on applying gas, turning, moving from a place to another place

35 Objects hide information n Objects hide the attributes and behavior from others n Information hiding means the details of implementation are hidden n Objects can communicate through interfaces n Do you need to know how car brakes or accelerator work?

36 Our Approach n In this course, we primarily focus on structured programming n A good structured programming background would help you a lot in object oriented programming n The behavior of objects will be ultimately built from structured programming constructs

37 Class Work n Finish the NiMo varying rates program and test it with two sample customers. One customer will have rate A applied and the other one will have rate B applied to the monthly bill.


Download ppt "Computer Science-I (CSIT121) Dr. Junaid Ahmed Zubairi SUNY Fredonia Room 210, Fenton X-4694,"

Similar presentations


Ads by Google