Presentation is loading. Please wait.

Presentation is loading. Please wait.

AKA Stepwise refinement

Similar presentations


Presentation on theme: "AKA Stepwise refinement"— Presentation transcript:

1 AKA Stepwise refinement
Top-down design AKA Stepwise refinement

2 Objective To understand what top-down design is

3 Top-down design A complex problem needs to be broken down into smaller and smaller sub-problems until all the sub problems can be solved easily otherwise the problem will be too complex to allow for a satisfactory solution. This process is called top-down design or step-wise refinement.

4 Writing a wages application
What information would you need to know? “Consider the problem of calculating the wages for an hourly paid worker. The worker is paid £6.50 per hour for up to 40 hours and time-and-a-half for all hours over 40. Tax and National Insurance contributions have to be deducted.” How would you work out someone's wages? High level, in order Create a numbered list

5 Wages Application In Word write out a list of all the tasks you need to do to solve the wages problem. These tasks should be in order. For example you need to get the number of hours worked before you can calculate the pay. Use a format like 1 then 1.1 for subtasks and if needed for sub sub tasks! Wages 1.1 Get number of hours worked 1.2 Calculate gross pay 1.2.1 Calculate normal wages 1.2.2 Calculate overtime 1.3 Calculate deductions 1.3.1 Calculate tax 1.3.2 Calculate National insurance 1.4 Calculate net pay 1.5 Output wages slip

6 Structure diagram of wages application
Get number of hours Calculate gross pay Calculate normal wages Calculate overtime Calculate deductions Calculate tax Calculate National Insurance Calculate net pay Output wages slip Structure diagram is another way of representing this breakdown of task. Students need to know the term “structure diagram”.

7 1.1 Get number of hours worked 1.2 Calculate gross pay
Wages 1.1 Get number of hours worked 1.2 Calculate gross pay 1.2.1 Calculate normal wages 1.2.2 Calculate overtime 1.3 Calculate deductions 1.3.1 Calculate tax 1.3.2 Calculate National insurance 1.4 Calculate net pay 1.5 Output wages slip Section Subroutine Note 1.1 GetHours() Returns an integer in range 0 to 60 1.2 CalculateWages(Hours) Returns gross wage 1.2.1 CalculateNormalWages(Hours) Returns wage for up to 40 hours 1.2.2 CalculateOvertime(Hours) Returns pay for any hours over 40 1.3 CalculateDeductions(GrossWage) Returns total deductions 1.3.1 CalculateTax(GrossWage) Returns tax due 1.3.2 CalculateNI(GrossWage) Returns N.I. due 1.4 CalculateNetWage(GrossWage, Deductions) Returns net wage 1.5 OutputResults(Hours, GrossWage, Tax, NI, Deductions, NetWage) Outputs wage slip It can be useful to turn each numbered statement into a separate subroutine. In reality each of these subroutines may need further subroutines. Note: Section 1.2 CalculateWages(Hours) will use subroutines for and etc

8 Task Create a structure diagram to represent:
A system asks a teacher for a student’s name and the number of marks they got in the end of year test. The system will calculate a percentage and a grade based on the percentage. It will then print a certificate with the students name, percentage and grade on it.

9 Calculate percentage and grade
Possible answer Certificate System Get student name Get number of marks Calculate percentage and grade Calculate percentage Calculate grade Output certificate


Download ppt "AKA Stepwise refinement"

Similar presentations


Ads by Google