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
ID: 10732245
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

ID: 10732371
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

ID: 10734169
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 :)
Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

LVL 11

Accepted Solution

Mighty_Silly earned 300 total points
ID: 10734656
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

ID: 10735473
thanks guys, your help has been much appreciated..
LVL 27

Expert Comment

ID: 10736051
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

ID: 10737701
Glad I could help


Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

776 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