Monday 12 August 2013

Validation and error trapping

1. 
Pseudocode
Calculate price of sending parcel
Prompt user for ItemWeight, CostPerKilo
Get ItemWeight, CostPerKilo

If ItemWeight is a number and CostPerKilo is a number
 
CostofSendingParcel = ItemWeight * CostPerKilo
If CostofSendingParcel < 100
Display CostofSendingParcel
Else
CostAfterDiscount = CostofSendingParcel * 0.9
Display CostAfterDiscount
End If

Else Display ErrorMessage
 
End
2.
 

No comments:

Post a Comment