developing a solution a staged design process. initial requirements car hire business three types of...

26
Developing a solution A staged design process

Upload: amy-bishop

Post on 04-Jan-2016

216 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Developing a solution A staged design process. Initial requirements Car Hire business Three types of car Small, medium, large Different rates – hire,

Developing a solution

A staged design process

Page 2: Developing a solution A staged design process. Initial requirements Car Hire business Three types of car Small, medium, large Different rates – hire,

Initial requirements

Car Hire business Three types of car Small , medium , large Different rates – hire , insurance , mileage Requirement to enter details, calculate and

print bill Refund balance of deposit paid

Page 3: Developing a solution A staged design process. Initial requirements Car Hire business Three types of car Small, medium, large Different rates – hire,

Rates and charges

Car type Engine size

Daily Hire rate

£ / day

Insurance rate

£ / day

Mileage rate

£ / mile

A <1200cc 15.95 2.25 0.45

B 1200 –

1600 cc

20.50 3.25 0.55

C > 1600 cc 26.75 4.75 0.65

Page 4: Developing a solution A staged design process. Initial requirements Car Hire business Three types of car Small, medium, large Different rates – hire,

Process Definition

When car booked pay deposit of £50 Cost is calculated from type of car, number of

days on loan Hirer must be informed of excess charge or

refund Application user to input details of car type,

start miles and finish miles A print out of the bill to be printed

Page 5: Developing a solution A staged design process. Initial requirements Car Hire business Three types of car Small, medium, large Different rates – hire,

Possible Screen

What are the design considerations ?

Who will be using the system?

Where will it be sited?

What other activities are performed?

How frequently will it be used?

How much is response time critical ?

Page 6: Developing a solution A staged design process. Initial requirements Car Hire business Three types of car Small, medium, large Different rates – hire,

Option buttons

Frame control

Alternatives to Command Buttons

Page 7: Developing a solution A staged design process. Initial requirements Car Hire business Three types of car Small, medium, large Different rates – hire,

What is a mutually exclusive decision ?

When the user can onlychoose one from the

list of options

Page 8: Developing a solution A staged design process. Initial requirements Car Hire business Three types of car Small, medium, large Different rates – hire,

Option buttons

The best way to offerthe user such a choice

Allows the user to select a single item from a number of alternatives

Page 9: Developing a solution A staged design process. Initial requirements Car Hire business Three types of car Small, medium, large Different rates – hire,

Option buttons

When grouped together, then -

when one is selected and switched ‘on’, all the other option buttons are automatically deselected and switched ‘off’

Page 10: Developing a solution A staged design process. Initial requirements Car Hire business Three types of car Small, medium, large Different rates – hire,

Option buttons

Buttons are grouped by placing them inside a Frame

The Frame must be drawn first!

If a frame is made invisible, so are the controls within it

Page 11: Developing a solution A staged design process. Initial requirements Car Hire business Three types of car Small, medium, large Different rates – hire,

Key properties of Option buttons

Caption the words next to the button

Alignment writing to left / right of button?

Page 12: Developing a solution A staged design process. Initial requirements Car Hire business Three types of car Small, medium, large Different rates – hire,

Key properties of Option buttons

Value is the button selected or not?– When Value = True, the button is selected

A button can be set on either by the user clicking it, or within the code:– optFrance.Value = True

When a button is selectedall other buttons automaticallyhave their Value set to False

Page 13: Developing a solution A staged design process. Initial requirements Car Hire business Three types of car Small, medium, large Different rates – hire,

Command vs Option Buttons

Option buttons mutually exclusive

Frame provides logical grouping

HCI chunking

But….. Extra code to cater for

controlling operations Less intuitive for initiating

processes

Page 14: Developing a solution A staged design process. Initial requirements Car Hire business Three types of car Small, medium, large Different rates – hire,

Idle

Car B

Car A

Car C

Exit

Clear

Input Data

Input Data

Input Data

Clear / hideAll input & output

Exit to system

Calc & display

Calc & display

Calc & display

Page 15: Developing a solution A staged design process. Initial requirements Car Hire business Three types of car Small, medium, large Different rates – hire,

Process Design

High Level Design Nassi-Schneidermann Jackson Structured

Low level design Pseudo-code Structured English

Object-Oriented UML

All use program logic

to represent problem

i.e. selection, iteration , etc.

Represents solution in terms of data

Page 16: Developing a solution A staged design process. Initial requirements Car Hire business Three types of car Small, medium, large Different rates – hire,

Nassi-Shneidermann

If condition

ElseThen

While or For condition

Actions…..

Case

option

option

option

else

Sequence

Page 17: Developing a solution A staged design process. Initial requirements Car Hire business Three types of car Small, medium, large Different rates – hire,

NSD

While not Exit

Clear

Calculate

Car A

details and

display bill

Case of

Enter mileage and hire period

Calculate

Car B

details and

display bill

CalculateCar Cdetails and display bill

Page 18: Developing a solution A staged design process. Initial requirements Car Hire business Three types of car Small, medium, large Different rates – hire,

Pseudo Code

Command buttons Car A,Car B,Car C1. Input data from screen

1.1 Get days on hire and validate1.2 Get start and finish miles and validate1.3 Calculate mileage

2 Calculate the bill2.1 Hire charge = days hire * Hire rate2.2 Insurance charge = days hired * insurance rate2.3 Mileage charge = mileage * Mileage rate

3 Display the bill3.1 display car details3.2 Display component charges3.3 Display total bill charge3.4 Refund

Page 19: Developing a solution A staged design process. Initial requirements Car Hire business Three types of car Small, medium, large Different rates – hire,

Pseudocode 2

Command Button Clear1 Clear all input fields

1.1 Clear days on hire input

1.2 clear start mileage

1.3 clear finish mileage

2 Clear all output fields

2.1 clear car details

2.2 clear component charges

2.3 clear total bill

2.4 clear refund

3 set focus for input

3.1 set the focus to days on hire field

Page 20: Developing a solution A staged design process. Initial requirements Car Hire business Three types of car Small, medium, large Different rates – hire,

Variable List

Data Input

Private iDaysOnHire As Integer

Private iStartMiles As Long

Private iFinishMiles As Long

Private iMileage As Long

'Component Charges

Private cDayHireCharge As Currency

Private cInsuranceCharge As Currency

Private cMileageCharge As Currency

'Totalbill and refund variables

Private cTotalCharge As Currency

Private cRefund As Currency

Page 21: Developing a solution A staged design process. Initial requirements Car Hire business Three types of car Small, medium, large Different rates – hire,

Constant list

Const HIRERATEA = 15.95 'daily hire car A

Const INSURANCERATEA = 2.25 'insurance car A

Const MILEAGERATEA = 0.45 'mileage car A

Const HIRERATEB = 20.5 'daily hire car B

Const INSURANCERATEB = 3.25 'insurance car B

Const MILEAGERATEB = 0.55 'mileage car B

Const HIRERATEC = 26.75 'daily hire car C

Const INSURANCERATEC = 4.75 'insurance car C

Const MILEAGERATEC = 0.65 'mileage car C

Page 22: Developing a solution A staged design process. Initial requirements Car Hire business Three types of car Small, medium, large Different rates – hire,

Capture data from input

Private Sub Command1_Click()

'getting information from inputs

iDaysOnHire = Val(Text1.Text)

iStartMiles = Val(Text2.Text)

iFinishMiles = Val(Text3.Text)

iMileage = iFinishMiles - iStartMiles

cDayHireCharge = iDaysOnHire * HIRERATEA

cInsuranceCharge = iDaysOnHire * INSURANCERATEA

cMileageCharge = iMileage * MILEAGERATEA

cTotalCharge = cDayHireCharge + cInsuranceCharge + cMileageCharge

cRefund = DEPOSIT - cTotalCharge

Page 23: Developing a solution A staged design process. Initial requirements Car Hire business Three types of car Small, medium, large Different rates – hire,

Display Bill details

'display car bill - command1_click continued’

Label3.Caption = "Car type A hired Engine Capacity <1200cc"

Label7.Caption = iDaysOnHire & "days @" & Format$(HIRERATEA, "£0.00")

Label8.Caption = iDaysOnHire & "days @" & Format$(INSURANCERATEA, "£0.00")

Label9.Caption = iMileage & "miles @" & Format$(MILEAGERATEA, "£0.00")

Label10.Caption = Format$(cDayHireCharge, "£0.00")

Label11.Caption = Format$(cInsuranceCharge, "£0.00")

Label12.Caption = Format$(cMileageCharge, "£0.00")

Label13.Caption = Format$(cTotalCharge, "£0.00")

Label14.Caption = Format$(cRefund, "£0.00")

End Sub

Page 24: Developing a solution A staged design process. Initial requirements Car Hire business Three types of car Small, medium, large Different rates – hire,

Clear inputs and outputs

Private Sub Form_Load()

Text1.Text = ""

Text2.Text = ""

Text3.Text = ""

Label3.Caption = ""

Label7.Caption = ""

Label8.Caption = ""

Label9.Caption = ""

Label10.Caption = ""

Label11.Caption = ""

Label12.Caption = ""

Label13.Caption = ""

Label14.Caption = ""

End Sub

Page 25: Developing a solution A staged design process. Initial requirements Car Hire business Three types of car Small, medium, large Different rates – hire,

Result

Page 26: Developing a solution A staged design process. Initial requirements Car Hire business Three types of car Small, medium, large Different rates – hire,

Next …. Test the design !!

Create a test plan Dry run the code design Amend the code design accordingly