PHASE 1 What are the Steps of Phase

  • Slides: 21
Download presentation
PHASE 1

PHASE 1

What are the Steps of Phase 1? • Analysis • Algorithm • Flowchart •

What are the Steps of Phase 1? • Analysis • Algorithm • Flowchart • Verify

Let’s take a look at Step 3: FLOWCHARTS

Let’s take a look at Step 3: FLOWCHARTS

 • A diagram which shows the progression. Each diagram shows one part of

• A diagram which shows the progression. Each diagram shows one part of the code. Independent of programming language. • Easier to see mistakes in the algorithm • Easier to change & upgrade. (Other programmers understand what the code does)

Symbols INPUT / OUTPUT PROCESS OR STATEMENT START / TERMINATOR DECISION (BOOLEAN QUESTION) Flow

Symbols INPUT / OUTPUT PROCESS OR STATEMENT START / TERMINATOR DECISION (BOOLEAN QUESTION) Flow Line PROCEDURE CONNECTOR

How to make a FLOWCHART: • Group like steps together • Draw a flowchart

How to make a FLOWCHART: • Group like steps together • Draw a flowchart for EACH procedure starting with the main

Anything in quotes in input/output will be seen on screen. Variables to be used

Anything in quotes in input/output will be seen on screen. Variables to be used later should be put in parentheses. Do not abbreviate variables (within reason) All variables should be on the left side

PERFORM STEPS I-III of PHASE I FOR BRUSHING YOUR TEETH

PERFORM STEPS I-III of PHASE I FOR BRUSHING YOUR TEETH

ANALYSIS

ANALYSIS

Algorithm

Algorithm

Flowchart

Flowchart

 • Write a program to find the area of a triangle to the

• Write a program to find the area of a triangle to the nearest tenth. All information is entered as integers. • Enter the base and height • Calculate the area; • area = ½(base * height) • Round the area to the nearest 10 th. • Display the base, height, and area

START Find area Get. Info START Find. Area “What is the base and height”

START Find area Get. Info START Find. Area “What is the base and height” (base, height) area = (1/2)*(base * height) Find. Area END Displa y END

START Display “The base is “(base) The height is ”(height) “The area = “(area)

START Display “The base is “(base) The height is ”(height) “The area = “(area) END

Write a program to find the average grade for three students in a class.

Write a program to find the average grade for three students in a class. • Enter the 3 test grades ( test 1, test 2, test 3) • Find the average; – Average = (test 1 + test 2 + test 3) / 3 • Round the average to the nearest integer. • Display the average.

START Find average Get. Info Find. Av g Displa y END START Get. Info

START Find average Get. Info Find. Av g Displa y END START Get. Info “What are the test grades” (test 1, test 2, test 3) END START Find. Avg average = (1/3)*(test 1+test 2+test 3) Round average to nearest Integer END

START Display “The average for the class is “(average) END

START Display “The average for the class is “(average) END

TEST DATA • Each set of data should be different is some way then

TEST DATA • Each set of data should be different is some way then the next – General solution that is easily calculated – Types of input ( real vs integers) – At boundary values – Beyond specific boundary values – Error checking ( specific calculation errors. ie. Divide by zero)

Ex. Finding area Test Data • Base = 5 & height = 10 •

Ex. Finding area Test Data • Base = 5 & height = 10 • Base = 5 & height = 7 • Base = 0 & height = 8, base = 4 & height = 0 • Base = -2 & height = -4

Ex. Finding Average data • • • 100, 90, 80 80, 81, 83 80,

Ex. Finding Average data • • • 100, 90, 80 80, 81, 83 80, 81 -5, 100, 90 110, 90, 75

Practice Write a program to calculate the total bill for a restaurant given the

Practice Write a program to calculate the total bill for a restaurant given the total of all items, tax percentage, and the tip percentage. Total = $25. 00 Tax = 8% Tip = 20% Total bill = $32. 00 Write the analysis, algorithm, flowchart, test data.