PDA

View Full Version : Pseudo code



j0rd
17-01-2011, 04:36 PM
I need help, need to create a pseudo code on the following question.


An online shop has delivery charges of £2.99 for sales up to £20, £4.99 for sales between £20 and £50. Delivery is free for sales more than £50.

For sales of a single item a programme is to be written that inputs the unit cost of an item and the quantity purchased and calculates and outputs the total cost of the order.

Tried and could not do it. Hate pseudo codes :(

redtom
17-01-2011, 06:18 PM
A level computing? Pseudo code annoyed the hell out of me, just write out how you would in what ever language your most comfortable with and convert it to Pseudo.

j0rd
17-01-2011, 06:20 PM
I done it then, thanks though!
And I do National Diploma ICT, Programming is a unit :(

Stephen!
17-01-2011, 06:39 PM
itemprice = keyboard input
delivery20 = 2.99
delivery20to50 = 4.99
deliveryfree = 0



input item price



if itemprice < 20

then

output itemprice + delivery20



else if itemprice >= 20 <=50

then

output itemprice + delivery50



else

output itemprice + deliveryfree




Something like that anyway.

j0rd
17-01-2011, 06:43 PM
itemprice = keyboard input
delivery20 = 2.99
delivery20to50 = 4.99
deliveryfree = 0



input item price



if itemprice < 20

then

output itemprice + delivery20



else if itemprice >= 20 <=50

then

output itemprice + delivery50



else

output itemprice + deliveryfree




Something like that anyway.

Mine was kind of like that, a bit more simple though :P


BEGIN
Input cost of sale
Delivery = £2.99
IF cost of sale > £20 and < £50
Delivery = £4.99
If cost of sale > £50
Delivery = £0.00
Output delivery cost
END

Stephen!
17-01-2011, 06:45 PM
You have no variables :P

But yeah, that's it in it's most basic form.

Mine would be easier to write out in whatever language you need.

j0rd
17-01-2011, 06:48 PM
We're not really going to write it in a language. It's just homework really, where working on pseudo codes.

Want to hide these adverts? Register an account for free!