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
4 replies to this topic
#1
Posted 10 February 2012 - 05:15 PM
|
|
|
#2
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:
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.
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.
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
Posted 11 February 2012 - 02:58 PM
Welcome aboard!
#4
Posted 12 February 2012 - 03:14 AM
Welcome to CodeCall!
Think my post we're usefull? Please take your time and press the Like button at my post, Big Thanks!
For great C# & Android tutorials visit my blogg: http://www.thecompboy.com/
For great C# & Android tutorials visit my blogg: http://www.thecompboy.com/
#5
Posted 16 February 2012 - 01:29 PM
Welcome to Codecall, mirror1! Post your questions in the programming subsections so other members can benefit. :thumbup:
Perfection of means and confusion of ends seem to characterize our age. Albert Einstein :confused:
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users


Sign In
Create Account

Back to top









