The document discusses problem solving techniques for programming, including the programming cycle (software development life cycle and product development life cycle), developing algorithms using flowcharts and pseudocode, and basic control structures like sequential, selection, and repetition. It provides examples of using pseudocode and flowcharts to develop algorithms to calculate the area of a rectangle and find the roots of a quadratic equation. Finally, it shows a basic Python program with flowchart to calculate BMI.
The document discusses problem solving techniques for programming, including the programming cycle (software development life cycle and product development life cycle), developing algorithms using flowcharts and pseudocode, and basic control structures like sequential, selection, and repetition. It provides examples of using pseudocode and flowcharts to develop algorithms to calculate the area of a rectangle and find the roots of a quadratic equation. Finally, it shows a basic Python program with flowchart to calculate BMI.
The document discusses problem solving techniques for programming, including the programming cycle (software development life cycle and product development life cycle), developing algorithms using flowcharts and pseudocode, and basic control structures like sequential, selection, and repetition. It provides examples of using pseudocode and flowcharts to develop algorithms to calculate the area of a rectangle and find the roots of a quadratic equation. Finally, it shows a basic Python program with flowchart to calculate BMI.
2.3 Control Structure (Sequential; Selection; Repetition)
By: Dr. Nickholas Anting Anak Guntor
Programming Cycle Series of step or sequence for developing a softwares or products.
Software Development Life Cycle
Structural approach used for developing particular software products.
Product Development Life Cycle
Process that is responsible for bringing to market a new product and generally includes the business units. By: Dr. Nickholas Anting Anak Guntor By: Dr. Nickholas Anting Anak Guntor By: Dr. Nickholas Anting Anak Guntor By: Dr. Nickholas Anting Anak Guntor Development of Algorithm • Computer algorithm – an order sequence of instructions for solving problem. • Basic technique used to get the job done.
Example: The taxi algorithm
1. Go to the taxi stand. 2. Get in a taxi. 3. Give the driver my address.
By: Dr. Nickholas Anting Anak Guntor
By: Dr. Nickholas Anting Anak Guntor By: Dr. Nickholas Anting Anak Guntor Pseudocode Features Examples: ▪ Cannot understand by Calculate the area of rectangular. computer. BEGIN INPUT & DECLARE length ▪ Jot down ideas using human- INPUT & DECLARE width CALCULATE area = width * length readable language – no worry DISPLAY area syntax error. END
▪ Not standardized; every
program has its own version.
▪ Capitalized main key-
function. By: Dr. Nickholas Anting Anak Guntor Flowchart Features
▪ Used standardized symbols.
▪ Can draw by hand or
word processor.
▪ Different symbols are
used for different states in flowchart.
By: Dr. Nickholas Anting Anak Guntor
Examples of Flowchart Example 1: Add two numbers entered Example 2: Find all the roots of a by user. quadratic equation ax + bx + c = 0.
By: Dr. Nickholas Anting Anak Guntor
Control Structure ▪ Control Structures – Provide alternatives to sequential program execution and are used to alter the sequential flow of execution. ▪ Most common control structures are: Repetition/ Looping/
By: Dr. Nickholas Anting Anak Guntor
Basic Python Language with Flowchart Part 2
By: Dr. Nickholas Anting Anak Guntor
START #This program is to calculate area of rectangular
print (“This is BMI Calculator”)
DECLARE float berat,tinggi,bmi #Declaring variable & gathering input weight = float (input(“Enter Your Weight: ”)) height = float (input(“Enter Your Height in meter: ”)) INPUT berat, tinggi
EXERCISE 1 A group of programmer has been assigned to make a simple sequential program to calculate BMI index for users.
a) List the Input, Process and Output.
b) Create flowchart & pseudocode of the above situation. c) Write a program based ion the flowchart using Python language.
BMI = weight / height2
By: Dr. Nickholas Anting Anak Guntor
By: Dr. Nickholas Anting Anak Guntor QUIZ 1 A concert hall has three seating categories: Orchestra, Main floor, and Balcony. Orchestra seats are RM25. Main floor seats are RM30 and Balcony seats are RM15. The manager wants a program that allows him to enter the number of tickets sold in each seating category. The program should calculate and display the amount of revenue generated by each seating category, as well as total revenue.
a) Create pseudocode of the above situation.
b) List the Input, Process and Output. c) Create a flowchart for the above situation.