Presentation is loading. Please wait.

Presentation is loading. Please wait.

Problem Solving INFORMATION TECHNOLOGY

Similar presentations


Presentation on theme: "Problem Solving INFORMATION TECHNOLOGY"— Presentation transcript:

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

2 CXC IT Syllabus Section 2 Obj 2: identify ways of representing algorithms;
Psuedocode - is an algorithm that models or resembles the real programming language of a computer. It cannot be executed by the computer. Flowcharts – consists of a set of symbols that are used to represent programming logics.

3 Use of Input Statements
Input statements are used to place data inside the computer for the programmer to use. In Psuedocode Algorithm, Read, is used to enter data. For e.g. Write a psuedocode algorithm to input a number Begin Read N END. Write a statement to accept the day, month and year a person is born. Read Day Read Month Read Year Begin Read Day, Month, Year END.

4 Use of Output Statements
Output statements are used to get information out of the computer by the program. In Psuedocode Algorithm, Print, is used to display information. For e.g. Write a psuedocode algorithm to print your name. Begin Read Name Print “Your name is “ Name END. Write a statement to display the time. Read Time Print “The time is “ Time Information or instructions entered between quotation marks are printed as is.

5 Use of Output Statements
Output statements may also be used when prompting for information. Similarly, Output statements maybe useful to caption. For e.g. Write a psuedocode algorithm prompt the user to enter their first and last name and provide output. Begin Print “Enter your first name.” Read FName Print “Enter your last name.” Read Lname Print “Your full name is “ Fname LName END. Write a psuedocode to request the user to enter their age and print it. Print “Enter your age.” Read Age Print “Your age is “ Age END

6 Use of Assignment Statements
Mathematical Operators used + (Add), - (Subtract), / (Divide), * Multiplication. Assignment statements are used to assist in making calculations inside a program. The Assignment statement is used to give a value to a variable. Assignment statements can be also used to change the value of a variable. The Assignment Operator is . Write a psuedocode algorithm to ask the user to input the name of a student, the marks he/she received in a test and the maximum number of marks in the test. Calculate the percentage mark the student receive. Print the information with suitable labels. Increasing the value of Salary by 2%. Salary  Salary * (.02 * Salary) Print “Enter your name.” Read Name Print “Enter the marks received.” Read Marks Print “Enter maximum marks in test.” Read MaxMarks Percentage  Marks/MaxMarks Print “The percentage score is “ Percentage END.

7 Use of Assignment Statements
Write a structured algorithm to prompt the user to input the ages of four students. The algorithm should allow the user to input these ages, find the average and print it with suitable label. Write a psuedocode algorithm to ask the user to input the radius of a circle. Calculate the diameter and print with suitable label. Print “Enter the ages of four students.” Read Age1, Age2, Age3, Age4 Sum  Age 1+Age2+Age3+Age4 AvgAge  Sum/4 Print “The average age is “ AvgAge END. Print “Enter the radius for the circle.” Read Rad Diameter  Rad * 2 Print “The diameter of the circle is “ Diameter END.

8 Assignment Statement (cont’d)
Write a structured algorithm that prompts the user to input the number of days in a month. Calculate and print the number of hours in the month appropriately labelled. Note how Constants are used for MaxHours as there are a fixed number of days in the month. MaxHours = 24 Print “Enter the number of days.” Read Days Hours  Days * MaxHours Print “The number of hours in the month is “ Hours END. Write a structured algorithm to prompt the user to enter the side length of a square. Calculate and print the square with an appropriate label. Print “Enter the side of a square.” Read Side Area  Side * Side Print “The area is “ Area END.


Download ppt "Problem Solving INFORMATION TECHNOLOGY"

Similar presentations


Ads by Google