Presentation is loading. Please wait.

Presentation is loading. Please wait.

Andrew C. Samuels, Information Technology Specialist Trainer c/o Ministry of Education Mona High School, Kingston, Jamaica 1 Problem Solving Section 2:

Similar presentations


Presentation on theme: "Andrew C. Samuels, Information Technology Specialist Trainer c/o Ministry of Education Mona High School, Kingston, Jamaica 1 Problem Solving Section 2:"— Presentation transcript:

1 Andrew C. Samuels, Information Technology Specialist Trainer c/o Ministry of Education Mona High School, Kingston, Jamaica 1 Problem Solving Section 2: Obj. 1 & 2 CXC IT Syllabus

2 CXC IT Syllabus – Section 2 Objective 1 outline the steps in problem-solving; Definition of the problem; propose and evaluate solutions; determination of the most efficient solution; develop and represent algorithm; test and validate the solution. 2 Problem Solving? The process by which a person finds the best solution to a situation that requires a solution. A problem is a discrepancy between what is required and what exists. A solution is a procedure consisting of a set of instructions that, if followed in order, achieve the required results.

3 Stages in Problem Solving 1.Define the problem - say what the problem being faced is. 2.Propose and evaluate solutions – come up with a list of solutions/approaches that may solve the problem. 3.Determine the most efficient solution – chose the best solution. 4.Represent the most efficient solution in the form of an algorithm – represent using algorithm solution which is a step by step solution to solving problem. 5.Test the algorithm – check if the problem is solved after solution was implemented. 3

4 What is a Problem Statement? A clear definition of the problem that needs to be solved. The Statement must clear, concise, and unambiguous. The statement should not exceed two sentences at most. The program will accept values for two ages of students and calculate the average age. The average age is to be displayed. The program will accept three numbers and calculate their sum. Output of sum is to be provided. 4 Are these #s whole #? Percentages?

5 Defining Diagrams (Input, Processing and Output) – IPO Chart InputProcessingOutput 1.Read Num1 2.Read Num2 1.Read Num1, Num2 2.Calculate total. 3.Print Total Total A table diagram with three columns that summarises the Inputs, Processing and Outputs of the program/problem. 5 Write a program to read two numbers and print the total. Input – what data will be placed into the computer. Read is used to record this. Processing – what actions will be taken to derive output. Output – the results that is to be achieved.

6 Read the price of an item and its type. A 5% discount is to be given on all books. If the item is a CD then there will be a 10% discount and 2% on all other items. Calculate and print both the discount as well as the discounted price. 6 InputProcessingOutput 1.Read ItemName 2.Read ItemType 1.Read ItemName 2.Read ItemType 3.Calculate Discount 4.Calculate the DiscountedPrice 5.Print Discount 6.Print Discounted Price Discount DiscountedPrice

7 1. Construct defining diagram for a program to accept the age of two students and print the difference between the two. 7 InputProcessingOutput 1.Read Age1 2.Read Age2 1.Read Age1 2.Read Age2 3.Calculate Difference 4.Print Difference Difference 2. Construct defining diagram for a program to print the larger of two numbers. InputProcessingOutput 1.Read Num1 2.Read Num2 1.Read Num1 2.Read Num2 3.Determine Larger Number 4.Print Larger Larger

8 3. Write a defining diagram to read in two numbers, calculate and print their sum, difference and product. 8 InputProcessingOutput 1.Read N1 2.Read N2 1.Read N1, N2 2.Calculate Sum 3.Calculate Difference 4.Calculate Product 5.Print Product, Sum, Difference Sum Product Difference 4. Construct IPO to read an employee hourly rate and hours worked. Calculate and print Total wages. InputProcessingOutput 1.Read Hours 2.Read Rate 1.Read Hours, Rate 2.Calculate Wage 3.Print Wage Wage

9 9 InputProcessingOutput 1.Read Hours 2.Read Rate Set OTRate = Read Hours, Rate 2.Calculate Normal Hours (Hours – 40) 3.Calculate Normal Pay (Normal Hours * Rate) 4.Calculate OTPay 5. Calculate Total Wages Normal Pay + OTPay 6. Print Total Wages Total Wages 5. Employees are paid one and a half times hourly rate for each hour over 40 hours. Read the number of hours, and the rate being paid. Print the total wages for the employee (including overtime).

10 10 InputProcessingOutput 1.Read Height 2.Read Base Assuming a right angle triangle. 1.Read Height, Base 2.Calculate Area Base/2 * Height 3. Print Area Area Write a program to enter the base and height of a triangle and print the area.

11 11 InputProcessingOutput 1.Read Radius Set Pi = Read Radius 2.Calculate Area 2 * Pi * Radius * Radius 3.Calculate Circumference Pi * Radius * Radius 4. Print Area, Circumference Area Circumference Write a program to calculate and print the area and circumference of a circle given its radius.

12 Terminologies Algorithm – a sequence of instructions which if followed, produces a solution to the given problem. Step by step instructions for solving a problem in a specified number of times. Psuedocode – is an algorithm that models or resembles the real programming language of a computer. It cannot be executed by the computer. Computer Program – a set of computer instructions which are used for solving a problem. 12


Download ppt "Andrew C. Samuels, Information Technology Specialist Trainer c/o Ministry of Education Mona High School, Kingston, Jamaica 1 Problem Solving Section 2:"

Similar presentations


Ads by Google