+ All Categories
Home > Software > DISE - Programming Concepts

DISE - Programming Concepts

Date post: 19-Feb-2017
Category:
Upload: rasan-samarasinghe
View: 29 times
Download: 0 times
Share this document with a friend
25
Diploma in Software Engineering Module II: Programming Concepts Rasan Samarasinghe ESOFT Computer Studies (pvt) Ltd. No 68/1, Main Street, Pallegama, Embilipitiya.
Transcript
Page 1: DISE - Programming Concepts

Diploma in Software Engineering

Module II: Programming Concepts

Rasan SamarasingheESOFT Computer Studies (pvt) Ltd.No 68/1, Main Street, Pallegama, Embilipitiya.

Page 2: DISE - Programming Concepts

Contents

1. What is computer programming?2. Programming Styles3. Unstructured Programming4. Structured Programming5. Object Oriented Programming6. Computer Programs7. Concept of Algorithm8. Computer Programs9. Concept of Algorithm10. Flow Charts11. Questions12. Pseudo Codes

Page 3: DISE - Programming Concepts

What is computer programming?

Programming is giving instructions to the computer how to interact with the user or perform specific task.

Within software engineering, programming is regarded as one phase in a software development process.

Page 4: DISE - Programming Concepts

Programming Styles

There are 3 main programming styles

1. Unstructured Programming2. Structured Programming3. Object Oriented Programming

Page 5: DISE - Programming Concepts

Unstructured Programming

• Unstructured programming is the historically earliest programming paradigm.

• It is procedural, the statements are executed in sequence as written.

• This type of programming uses goto statements. A goto statement allows control to be passed to any other place in the program.

• Difficult to understand the logic of the program.

Ex: Machine Language, COBOL

Page 6: DISE - Programming Concepts

Structured Programming

• Structured programming also a subset of procedural programming that enforces to write efficient code easier to understand and modify.

• Use of the goto statement is discouraged. • Structured programming using 3 controls

constructs:– Sequence– Selection– repetition

Ex: Pascal, Ada

Page 7: DISE - Programming Concepts

Object Oriented Programming

• Object-oriented programming (OOP) is a programming model organized around objects rather than actions and data rather than logic.

• It is more popular in present, because it has an ability to represent complex relationships, data and data processing with suitable notations.

Ex: Java, C++, C#

Page 8: DISE - Programming Concepts

Computer Programs

• Sequential ProcessingInstructions are performed one after other in the computer.

• Concurrent ProcessingInstructions are performed in parallel within the computer.

Input xInput yTotal = x+yInput zTotal = total +z

Input xInput yTotal = x+yInput zTotal = total +z

Page 9: DISE - Programming Concepts

Concept of Algorithm

• An algorithm is a set of steps for solving a particular problem.

• Algorithm steps are unambiguous and have a clear stopping point.

• Algorithms can be expressed in any language, from natural languages or programming languages.

Page 10: DISE - Programming Concepts

Flow Charts

A flowchart is a diagrammatic representation of the process involved to provide a solution to a problem.

Page 11: DISE - Programming Concepts

Flow Chart Notations

Start / End of the program

Input / Output

Process

Decision / Repetition

Flow

Connector

Page 12: DISE - Programming Concepts

Flow Charts

• Question 1:Draw a flowchart to develop a program to input the student index number, name and total marks scored in three modules and display the students index number, name and average marks on the screen.

Page 13: DISE - Programming Concepts

Flow Charts

• Question 2:Draw a flowchart to develop a program to input stno, name, module one marks and module two marks and display stno, name, avg marks and total marks.

Page 14: DISE - Programming Concepts

Flow Charts

• Question 3:A student has sat for an exam and following details entered through the keyboard; “student number, name and average marks”. If he scored more than 50 as average marks he will be graded as “pass”, otherwise graded as “fail”. Draw a flowchart to display the student name, average and grade.

Page 15: DISE - Programming Concepts

Flow Charts

• Question 4:Draw a flowchart to input two numbers from the keyboard and evaluate and display the maximum value.

Page 16: DISE - Programming Concepts

Flow Charts

• Question 5:Draw a flowchart to develop a program to input student no, name, module one and module two marks by the keyboard and display student no, average and the grade. The grading system is as follows. Average greater than 75 grade is “distinction”, between 50 and 75 grade is “credit”, between 25 and 50 grade is “pass” and less than 25 is “fail”.

Page 17: DISE - Programming Concepts

Flow Charts

• Question 6:Draw a flowchart to calculate and display the sum of first five natural numbers.

Page 18: DISE - Programming Concepts

Flow Charts

• Question 7:Draw a flowchart to input a number from keyboard, and there after calculate and display the factorial number of it.

Page 19: DISE - Programming Concepts

Flow Charts

• Question 8:The program has to read a file stored in the disk in which each record contain customer number, customer name and amount. Display only the name of the customers who has amount greater than 1000. Draw a flowchart for the above scenario.

Page 20: DISE - Programming Concepts

Flow Charts

• Question 9:A program has to be developed to read a file stored in the disk in which each record contain employee number, name, basic salary, allowances and deductions. Calculate and display all employee names with their net salary. Draw a flowchart for the above problem.

Page 21: DISE - Programming Concepts

Flow Charts

• Question 10:A program has to be developed to read a file stored in disk in which each record contain employee no, name and hours worked. Calculate and display the percentage of employees those who has worked more than 40 hours. Draw a flowchart for the above program.

Page 22: DISE - Programming Concepts

Flow Charts

• Question 11:A program has to be developed to read a file stored in disk in which each record contain student no, name, subject one marks and subject two marks. Program is displaying two student names who has got highest marks and lowest marks with their total marks. Draw a flowchart for the above program.

Page 23: DISE - Programming Concepts

Pseudo Codes

Pseudo code consists of short, English phrases used to explain specific tasks within a program's algorithm. Pseudo code should not include keywords in any specific computer languages. It should be written as a list of consecutive phrases.

Page 24: DISE - Programming Concepts

Pseudo Codes

One of the concepts in programming is…

PROGRAM = DATA + ALGORITHM

Data Data types: String, Integer, Real Data usage: Variable, Constant Data scope: Global data, Local data

Algorithm Sequence Selection Repetition

Page 25: DISE - Programming Concepts

The End

http://twitter.com/rasansmn


Recommended