Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

pseudocode clarification

Posted on 2004-04-01
7
Medium Priority
?
582 Views
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
0
Comment
Question by:elusivesoul
7 Comments
 
LVL 101

Assisted Solution

by:mlmcc
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

mlmcc
         
0
 

Author Comment

by:elusivesoul
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+
mitso

If they choose
Barina
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
0
 

Expert Comment

by:pyromatt
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 :)
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 11

Accepted Solution

by:
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.
:Caculate
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
Prompt user to fulfill both requirements

==============

-Silly-
0
 

Author Comment

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

Expert Comment

by:jjafferr
ID: 10736051
Hi elusivesoul,

1-
make a textbox, call it Weight,
2-
make either
a Combobox, call it AirSurface, with List values as Air; Surface (I will use this option for this example).
OR
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
3-
make a Command button, call it Command1
4-
Make another txt box, call it  TotalPrice.
5-
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

jaffer
0
 
LVL 101

Expert Comment

by:mlmcc
ID: 10737701
Glad I could help

mlmcc
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

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…
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…
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…
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…

916 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