pseudocode clarification

Posted on 2004-04-01
Last Modified: 2010-05-18
Hi guys, I'm no good at pseudocode. But I want to confirm with an expert, how would you professionally
write pseudocode from the below information.

Calculate Postage based on the following..

1. user will enter the weight of the item being posted in a text box
2. user will select the service required (there must be two options air and
surface mail)
3. user then will press calculate button that will display the cost.


Yes, i know it sounds simple, but call me paranoid. Have to make sure its to the boss's liking.
Thankyou in advance
Question by:elusivesoul
LVL 100

Assisted Solution

mlmcc earned 200 total points
Comment Utility
I won't guarantee it is to the bosses liking

1.  Get weight of package from the user
     a.  Prompt user for the weight - "What is the weight of the package being sent : "
     b.  Read user input
2.  Get the service level required
     a.  Prompt user for the service level
         1)  Repeat
              a)  Display menu A- Air  S - Surface
              b)  Read user selection
             Until selection is A or S
3.  When user requests calculation
     a.  Calculate postage due using the
          1) Air formula
          2) Surface formula

If this were to be a visual interface I would probably develop a screen view in VB or PowerPoint as

     Package Weight - TEXTBOX FOR ENTRY

    OPTION BOX    Air
    OPTION BOX    Surface

    COMMAND BUTTON - Calculate Postage

    Postage Due  -  TEXBOX FOR RESULT


Author Comment

Comment Utility
thanks mlmcc. Well, i was searching through our shared folder at work, and i came across this one from last year. How would u tailor it to the below one?.

ihcar            range                   age
barina       city                       17
skyline       country               21+

If they choose
Car val=1
If they choose skyline
Car val=2
If they choose mitso
Car val=3

If they choose city
Range val= 1
If they choose country
Range val=2

If age=17
Age val=3
If  age val=1

Total=car val + range val+ age val+ base rate

Expert Comment

Comment Utility
You need to know the surface and air formulas before you can write the proper pseudocode.
In other words, if a user enters a weight and selects surface, how do we work out the cost? and if they select a wieght and select air, how do we work out that cost?
If you tell us that we'll be able to give you proper pseudocode :)
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

LVL 11

Accepted Solution

Mighty_Silly earned 300 total points
Comment Utility
Going with the example you provided, how's this:

Calculate Postage based on the following..

1. user will enter the weight of the item being posted in a text box
2. user will select the service required (there must be two options air and
surface mail)
3. user then will press calculate button that will display the cost.

weight            service
user input         air
user input         surface

they enter weight (required. can't calculate with no weight)
weight = user input

they select service
If they choose Air
service val= 1
If they choose Surface
service val=2

Total=car val + range val+ age val+ base rate
Postage = (check Weight & check Service selection)
If both requirements are satisfied, proceed with below calculation.  If not, goto Prompt.
Define Service fee
Service Fee = Fulfill Service fee based on set formula.  formula is unknow at this time
(example:  Air = 1; 1 = 10 + base rate.
                Surface = 2; 2 = 20 + base rate)
Postage = Weight + Service Fee (from above determination.)
(since we don't know Service fee formula at this time, it is best to break it off into another
calculation, right before using the fee with weight.  This fulfills the "Modular" coding requirement.
Doing this allows flexibility when converting from pseudocode to real action.)
Note: Formula for Service

Prompt user to fulfill both requirements



Author Comment

Comment Utility
thanks guys, your help has been much appreciated..
LVL 27

Expert Comment

Comment Utility
Hi elusivesoul,

make a textbox, call it Weight,
make either
a Combobox, call it AirSurface, with List values as Air; Surface (I will use this option for this example).
2 check boxes in an option group, call them Air and give it an option value 1, and Surface and give it an option value 2
make a Command button, call it Command1
Make another txt box, call it  TotalPrice.
click on the properties of the command1 button, go to the On Click, and place the following in the code:

If me!AirSurface="Air" then
 TotalPrice=Weight * 1.2 ' assuming 1.2 is for Air mail
elseIf me!AirSurface="Surface" then
 TotalPrice=Weight * .8 ' assuming .8 is for Air mail
end if

Hope this helps

LVL 100

Expert Comment

Comment Utility
Glad I could help


Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now