Presentation on theme: "Problem Solving INFORMATION TECHNOLOGY"— Presentation transcript:
1 Problem Solving INFORMATION TECHNOLOGY 3/31/2017INFORMATION TECHNOLOGYProblem SolvingSection 2: Obj. 6 CXC IT SyllabusAndrew C. Samuels,Information Technology Specialist Trainerc/o Ministry of EducationMona High School, Kingston, JamaicaAndrew 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 YearBeginRead Day, Month, YearEND.
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 “ TimeInformation 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 NamePrint “Enter the marks received.”Read MarksPrint “Enter maximum marks in test.”Read MaxMarksPercentage Marks/MaxMarksPrint “The percentage score is “ PercentageEND.
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, Age4Sum Age 1+Age2+Age3+Age4AvgAge Sum/4Print “The average age is “ AvgAgeEND.Print “Enter the radius for the circle.”Read RadDiameter Rad * 2Print “The diameter of the circle is “ DiameterEND.
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 = 24Print “Enter the number of days.”Read DaysHours Days * MaxHoursPrint “The number of hours in the month is “ HoursEND.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 SideArea Side * SidePrint “The area is “ AreaEND.