modular design top-down design. design is represented by a hierarchy chart. break a problem into...

7
Modular Design Top-Down Design

Upload: lenard-barker

Post on 13-Dec-2015

212 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Modular Design Top-Down Design. Design is represented by a hierarchy chart. Break a problem into individual tasks or modules. If a module is too complex,

Modular Design

Top-Down Design

Page 2: Modular Design Top-Down Design. Design is represented by a hierarchy chart. Break a problem into individual tasks or modules. If a module is too complex,

Top-Down Design

• Design is represented by a hierarchy chart.• Break a problem into individual tasks or

modules.• If a module is too complex, break it down

into sub modules.• Transcribe the modules into pseudocode.• Code the modules using the three logical

structures of sequences, decisions, and repetition.

Page 3: Modular Design Top-Down Design. Design is represented by a hierarchy chart. Break a problem into individual tasks or modules. If a module is too complex,

Top-Down Design Criteria

• The design should be easily readable and emphasize small module size.

• Modules proceed from general to specific as you read down the chart.

• The modules, as much as possible, should only perform a single well-defined task.

• Modules should be as independent of each other as possible.

Page 4: Modular Design Top-Down Design. Design is represented by a hierarchy chart. Break a problem into individual tasks or modules. If a module is too complex,

Write a financial program that displays the monthly payment and total payment on a loan given the loan amount, yearly interest rate and loan duration (in years). The formula used to calculate the monthly payment is: (S*M* (M+1) N)/( (M+1)N)-1)

Where

M = monthly interest rateN = number of monthly paymentsS = loan amount

Page 5: Modular Design Top-Down Design. Design is represented by a hierarchy chart. Break a problem into individual tasks or modules. If a module is too complex,

Loan Program

Get Input Make Calculations

Display Results

Page 6: Modular Design Top-Down Design. Design is represented by a hierarchy chart. Break a problem into individual tasks or modules. If a module is too complex,

Loan Program

Get Input Make Calculations

Display Results

Get Amount

Get Duration

Get Interest

RateCompute Monthly Payment

Compute Total

Payment

Display Headings

Display Amounts

Page 7: Modular Design Top-Down Design. Design is represented by a hierarchy chart. Break a problem into individual tasks or modules. If a module is too complex,

Loan Program

Get Input Make Calculations

Display Results

Get Amount

Get Duration

Get Interest

RateCompute Monthly Payment

Compute Total

Payment

Display Headings

Display Amounts

Compute Monthly Interest

Rate

Compute Number

of Months