0

Im not really familiar with this kind stuff
I really need help with this:
develop an algorithm pseudo-code that will accept the names of each sales staff members and their total sales for the month. The algorithm must calculate the commission at 4 % of their total sales amount. It should display only the name, total sales and commission of the member with the highest commission and the number of persons without commission.

3
Contributors
2
Replies
25
Views
3 Months
Discussion Span
Last Post by john_111
1

Psuedo code is easy to find the definition on the web, so that's not the hurdle here.

What I want you to do is forget that you are coding. Imagine you have to do this manually. What steps would you take and to get it ready for a computer program, think about what values you need to get and calculate along the way to the answer.

No computer programming today. Just how would you do this, step by step.

Votes + Comments
Nice advise.
0

This is pseudo code

First do this to collect first number
Then do that to collect second number
     do an if
         continue or issue error message
         start collecting data again if wrong 
 Insert into database
    display data
       fetch user's name
    add the numbers together
       output sum to screen along with user name
    ask if this is correct
      do if 
        if no start again, if yes continue
   etc
   end 

Note the indents, just like a bit of code with brackets in it, things that are completed before the next bit starts.

It doesn't say exactly HOW you will insert data into the database or HOW to collect the user name or the numbers but it tells you the various steps involved. Then you expand some of the steps a bit more (such as the collect the numbers, or collect the username, or work out how to connect to the database)

Then when you have considered all the steps involved in detail, you would write the real code (but from the looks of your question, you aren't doing the actual code)

If there is a bit you are very unsure about coding, I often write a small snippet that does just that bit, and test it, so I know it's correct (such as writing the answer to screen to see if all the variables are there, before calculating and then trying to insert it into a database)

So pseudo code is the step before writing a program, where you work out what you need to do, programming is where you write the code to actually do it. It makes writing the actual code SOOOOO much easier if you know what you are going to do before you start writing 500 hundred lines of code, and discover that entering a letter instead of a number deletes your entire database, because you didn't check it was a number and your program just rumbles on, destroying things.

Edited by john_111

Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.