Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Pseudocode Help
Index -> General Programming
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
sherbertlemon




PostPosted: 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!!!
Sponsor
Sponsor
Sponsor
sponsor
Raknarg




PostPosted: Tue May 19, 2015 3:55 pm   Post subject: RE:Pseudocode Help

You can use if statements.

code:

if (some comparison) then
     do something
else if (some other comparison) then
     do something else
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
Display posts from previous:   
   Index -> General Programming
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 2 Posts ]
Jump to:   


Style:  
Search: