Jump to content

Check out our Community Blogs

Register and join over 40,000 other developers!

Recent Status Updates

View All Updates

- - - - -

Pseudocode problem help?


  • Please log in to reply
4 replies to this topic

#1 mirror1


    CC Lurker

  • New Member
  • Pip
  • 3 posts

Posted 10 February 2012 - 05:15 PM

Im a newbie to programming n barely started my class but my professor is already asking for too much.. I have other problems to do but this is one of them..

Here a problem
You will need to design an application that it will prompt a user for their hourly pay rate, their hours worked, and whether they are single, married, divorced, or widowed. It will then calculate their gross and net pay. If they work more than 40 hours, overtime is calculated at 1 ½ times the regular rate and displayed separately. If they are married, use a flat tax rate of 15%. If they are single, use 22%, if they are divorced, use 23%, and if they are widowed, use 13% (I realize that these are not very realistic). So how do i write this in a pseudocode and what would be the output? Any help would be appreciated thanks in advance
  • 0

#2 gregwarner


    Obi Wan of Programming

  • Expert Member
  • PipPipPipPipPipPipPip
  • 1586 posts
  • Location:Arkansas
  • Programming Language:C, Java, C++, C#, PHP, Transact-SQL

Posted 10 February 2012 - 08:05 PM

Believe it or not, the work is 99% already done for you. That paragraph you wrote above that describes the problem? That can be classified as a type of pseudocode. Pseudocode is nothing more than an informal step by step description of the steps the program must take. First, it will prompt the user for their hourly pay rate. Then, it will prompt for their hours worked. Then, it will prompt for their marital status. Then, it calculates pay by following these steps: If the number of worked hours is over 40, then...

You might notice I'm doing nothing but restating what's already written up there. That's exactly what you'll be doing when you write your pseudocode. You'll just be writing the steps in a manner that looks kinda like computer instructions, like this for example:
print "What is your hourly pay rate?"
payrate = Get double from console.
That is another way of phrasing the instruction "Prompt the user for their hourly pay rate." The pseudocode takes one further step and mentions the name of the variable which is storing this value, which can be used later in a computation.

Hope that helps. Just take each individual instruction from the description paragraph and list them out, and it'll all start to make sense to you.
  • 0

Hofstadter's Law: It always takes longer than you expect, even when you take into account Hofstadter's Law.
– Douglas Hofstadter, Gödel, Escher, Bach: An Eternal Golden Braid

#3 WingedPanther73


    A spammer's worst nightmare

  • Moderator
  • 17757 posts
  • Location:Upstate, South Carolina
  • Programming Language:C, C++, PL/SQL, Delphi/Object Pascal, Pascal, Transact-SQL, Others
  • Learning:Java, C#, PHP, JavaScript, Lisp, Fortran, Haskell, Others

Posted 11 February 2012 - 02:58 PM

Welcome aboard!
  • 0

Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

My MineCraft server site: http://banishedwings.enjin.com/

#4 Rakso


    CC Addict

  • Senior Member
  • PipPipPipPipPip
  • 335 posts
  • Programming Language:PHP, JavaScript
  • Learning:C++, PHP, Python, JavaScript

Posted 12 February 2012 - 03:14 AM

Welcome to CodeCall!
  • 0

I am a freelance web developer & web designer. I loves to make websites and would be happy to work with you.

Check out my portfolio: http://oskarmendel.me/

#5 fread


    Programming God

  • Senior Member
  • PipPipPipPipPipPip
  • 897 posts
  • Location:Trinidad and Tobago
  • Learning:C, Java, C++, C#, PHP, Python, PL/SQL

Posted 16 February 2012 - 01:29 PM

Welcome to Codecall, mirror1! Post your questions in the programming subsections so other members can benefit. :thumbup:
  • 0

Also tagged with one or more of these keywords: pseudocode

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download