Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


pseudocode clarification

Posted on 2004-04-01
Medium Priority
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 101

Assisted Solution

mlmcc earned 800 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 :)
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

LVL 11

Accepted Solution

Mighty_Silly earned 1200 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 101

Expert Comment

ID: 10737701
Glad I could help


Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

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

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…
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses
Course of the Month15 days, 6 hours left to enroll

578 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