Full Transcript

FLOWCHARTS Topic 1 Prepared by: Jay Vince D. Serato Flowchart What is a flowchart? Prepared by: Jay Vince D. Serato Flowchart Why do we need to use a flowchart? Prepared by: Jay Vince D. Se...

FLOWCHARTS Topic 1 Prepared by: Jay Vince D. Serato Flowchart What is a flowchart? Prepared by: Jay Vince D. Serato Flowchart Why do we need to use a flowchart? Prepared by: Jay Vince D. Serato Flowchart Flowchart is a diagrammatic or graphical representation of sequence of logical steps of a program. Flowcharts use simple geometric shapes to depict processes and arrows to show relationships and process/data flow. Prepared by: Jay Vince D. Serato Flowchart They help us visualize complex processes or make explicit the structure of problems and tasks. A flowchart can also be used to define a process or project to be implemented. Prepared by: Jay Vince D. Serato Flowchart Prepared by: Jay Vince D. Serato Parts of a Flowchart Prepared by: Jay Vince D. Serato TERMINATOR Prepared by: Jay Vince D. Serato Terminator also known as “Start/Stop” “End/Beginning” used at the end or the beginning to represent the start and end of a process Prepared by: Jay Vince D. Serato Prepared by: Jay Vince D. Serato PROCESS Prepared by: Jay Vince D. Serato Process Indicates processes or operations like mathematical operations. Prepared by: Jay Vince D. Serato Prepared by: Jay Vince D. Serato DATA Prepared by: Jay Vince D. Serato Data also known as “Input/Output” It represents information entering (input) or leaving (output) the system. An input might be an order from a customer. Output can be a product to be delivered. Prepared by: Jay Vince D. Serato DECISION Prepared by: Jay Vince D. Serato Decision Stands for decision statements in a program. The answer is usually Yes or No. Prepared by: Jay Vince D. Serato Prepared by: Jay Vince D. Serato ARROW Prepared by: Jay Vince D. Serato Arrow Lines represent the flow of the sequence and direction of a process. Prepared by: Jay Vince D. Serato Prepared by: Jay Vince D. Serato Sample Problem 1: ID Check You are the manager of a bar, and you can’t just let minors enter your establishment. Given an age of a person, determine if the person is a minor or an adult. Prepared by: Jay Vince D. Serato Sample Problem 2: Male or Female People tend to enter in the gender field one letter: M or F or their small letter equivalents. We know that the letter M (m) stands for Male and F (f) for female. Given a letter, may it be small or capital letter, determine if the gender is male or female. Prepared by: Jay Vince D. Serato Sample Problem 3: Even or Odd Numbers can be classified into 2 types: even or odd. Even numbers are those divisible by 2. Odd numbers are those not divisible by 2. Given a number, classify whether it is even or odd. Prepared by: Jay Vince D. Serato Sample Problem 4: Chance In a grading system, the student is either a pass or a fail. Some instructors have this grey area of conditional. If the score is 60 or beyond, print pass. If the score is in between 55 and 60, exclusive, print conditional. If the score is less than or equal to 55, print fail. Prepared by: Jay Vince D. Serato Exercise 6-1: Typhoon In the Philippines, we are visited by approximately 20 typhoons annually. Typhoons are classified into four categories: Tropical Depression, Tropical Storm, Severe Tropical Storm, and Typhoon. Tropical Depression only has wind speeds of less than 62 kilometers per hour (kph). Tropical Storm has wind speeds ranging from 62 to 88 kph. Severe Tropical Storm has ravaging wind speeds from 89 to 117 kph. Lastly, a Typhoon has destructive wind speeds of greater than 117 kph. Given a wind speed, output the category of the typhoon. Prepared by: Jay Vince D. Serato Exercise 6-2: Gas Money You work for a gas station and you manage the cars coming over to refill their tanks. Given the price per liter, the number of liters the customer wants, and the payment tendered, give out the change to the customer. If the payment is not enough, tell the customer how much he lacks. Prepared by: Jay Vince D. Serato Exercise 6-3: FizzBuzz You are a bit playful today so you decide to play with numbers. If a number is divisible by 3, output Fizz. If a number is divisible by 5, output Buzz. If a number is divisible by both, your output should be FizzBuzz. Prepared by: Jay Vince D. Serato Exercise 6-4: Cytus In the game Cytus, your score is determined with the following letters: S, A, B, C, D. Given a letter, classify how good you played. If the letter is S, output Excellent. If the letter is A, output Very Good. If the letter is B, output Good. If the letter is C, output Fair. If the letter is D, output Bad. Prepared by: Jay Vince D. Serato Exercise 8-1: Water Bill In CITWD, there are three packages users can avail in their water needs. Package A: P250.00 + P9.50 per cubic meter used Package B: P400.00 for the first 20 cubic meters used and P11.25 for every succeeding cubic meters Package C: P300.00 if you used less than 12 cubic meters, P525.00 if in between 12 and 25, and P750.00 if greater than 25 cubic meters Given a Package Deal and amount of cubic meters used, output the payment. Prepared by: Jay Vince D. Serato Sample Problem 0.1 Print all the numbers from 1 to 10. Prepared by: Jay Vince D. Serato Sample Problem 0.2 Print all the numbers from 1 to n. Prepared by: Jay Vince D. Serato Sample Problem 0.3 Print all the numbers from n to m. Prepared by: Jay Vince D. Serato Sample Problem 0.4 Add all the inputs until the user enters 0. Prepared by: Jay Vince D. Serato Sample Problem 0.5 Print all even numbers from 1 to 10. Prepared by: Jay Vince D. Serato Sample Problem: Valid Number Let the user enter a number from 1 to 100. If the user does not enter such, ask again until they do. Print the number inputted. Prepared by: Jay Vince D. Serato Sample Problem: Cashier Add all the prices for each of the items of the customer until the customer enters 0. Lastly, ask for the payment from the customer and give the change. If the payment is not enough, ask again until the customer inputs adequate amount. Prepared by: Jay Vince D. Serato

Use Quizgecko on...
Browser
Browser