Computer Science Canada

Pseudocode Help

Author:  sherbertlemon [ Tue May 19, 2015 2:57 am ]
Post subject:  Pseudocode Help

Hi, I am new to studying IT and i have an assignment question which is giving me trouble.

A little off topic, but if anyone here knows their pseudocode I have a question for you. I need to design an algorithm that calculates how much profit can be made by multiplying the remaining weight of stock and the price paid per KG. That part isn't too difficult however I need to apply profit margins: if the product was bought within 7 days only x% of it is profit, more than 7 days ago y% of it is profit.

Would appreciate any help and sorry for being off topic and a noob!!!

Author:  Raknarg [ Tue May 19, 2015 3:55 pm ]
Post subject:  RE:Pseudocode Help

You can use if statements.


if (some comparison) then
     do something
else if (some other comparison) then
     do something else
     do some other thing
end if

Because it's pseudocode, it shouldn't really matter the exact syntax you use as long as it's clear what your intention is.

If the first statement is true, it will execute the code inside. Otherwise, if the next statement is true, it will execute that code. Finally, if neither are true, it will execute the last piece of code there. You don't necessarily need the else if or the else statements, I'm just showcasing what each of those things mean