Showing posts with label If. Show all posts
Showing posts with label If. Show all posts
Tuesday, 13 August 2013
And
The value that needs to be stored in Number to display the message "This number does not meet the condition" are 7 or less or 11 or higher.
Monday, 12 August 2013
Or
The numbers 5, 6, 7 and 8 would need to be stored in Number to make the program display the message "This number does not meet the condition".
Validation and error trapping
1.
If ItemWeight is a number and CostPerKilo is a number
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
Else Display ErrorMessage
Tuesday, 6 August 2013
Apply Discount
Apply discount algorithm
Defining the problem:
The problem is that we need to find the cost of sending a parcel to someone and calculating the discount if the cost is more than $100.
Defining the inputs:
The inputs are; ItemWeight, CostPerKilo
Defining the outputs:
The outputs are; CostofSendingParcel, CostAfterDiscount
Define the processing:
1. Get the item weight
2. Get the cost per kilo
3. Calculate the cost of sending a parcel
4. If the cost of sending a parcel is less than $100, display the cost of sending a parcel
5. Else, apply a 10% discount
6. Display the cost after discount
Pseudocode
Calculate price of sending parcel
Prompt user for ItemWeight, CostPerKilo
Get ItemWeight, CostPerKilo
CostofSendingParcel = ItemWeight * CostPerKilo
If CostofSendingParcel < 100
Display CostofSendingParcel
Else
CostAfterDiscount = CostofSendingParcel * 0.9
Display CostAfterDiscount
End If
End
Subscribe to:
Posts (Atom)