Hi,

I deseparetly need help on designing a pseudocode for this program. I am new to programming, and totally lost. I started on it, but it doesn't seem right so could someone please check for me and help me out. I really need help! Here is the problem that I was given: 2. Create an application that continues to prompt the user for employee data and writes a report that contains a line for each employee. The application continues until the user enters 0 for an ID number to indicate the desire to quit. While the ID number is not 0, prompt the user for a value for each employee’s first and last names, street address, zip code, and job description code.
Any time the user enters an invalid value, continue to re-prompt the user for the same data. Invalid values are:
 An employee ID number that is negative or greater than 999
 A zip code that is not in the list of allowed zip codes
 A job description code that is not between 10 and 19 inclusive
Determine the employee’s city and state based on the zip code using the following table:
Zip Code City State
20175 Leesburg VA
20132 Purcellville VA
20164 Ashburn VA
20165 Potomac Falls VA
20113 Clinton MD
20112 Camp Springs

Determine the employee’s job title based on the following values. Determine the employee’s hourly pay rate based on the values in the following table. (Contract employees have an hourly rate of $0.)

Job Code Title
10 Desk Clerk
11 Credit Checker
12 Billing
13 Car cleaner
14 Chauffeur
15 Marketer
16 Accountant
17 CEO
18 Contract


Job Code Hourly Pay Rate($)
10-13 19.00
14-15 24.50
16-17 40.00
18 85.00
19 0.00

When all the needed data has been entered correctly for an employee, print the ID number, first and last names, street address, city, state, zip code, job code, job title, and hourly pay rate for each employee, and prompt the user for the next ID number. At the end of the report, print the following summaries:
 A count of the number of employees in each job code
 A count of the number of employees who live in each zip code
Flowchart and pseudocode the design.

This is the code i came up with:

START
20175 count <-- 0
20132 count <-- 0
20164 count <-- 0
20165 count <-- 0
20113 count <-- 0
20112 count <-- 0
job 10 count <-- 0
job 11 count <-- 0
job 12 count <-- 0
job 13 count <-- 0
job 14 count <-- 0
job 15 count <-- 0
job 16 count <-- 0
job 17 count <-- 0
job 18 count <-- 0

Write prompt message
Read id #, empfirstname, emplastname, st.address, zipcode, jobcode
DOWHILE id# =/= 0
valid data <-- true
IF id# < 0 or id# > 999 THEN
valid data <-- false
Write id#, empfirstname, emplastname, st.address, zipcode, jobcode, 'ID number cannot be negative or greater than 999'
ENDIF
IF zipcode =/= '20175' or zipcode =/= '20132' or zipcode =/= '20164' or zipcode =/= '20165' or zipcode =/= '20113' or zipcode =/= '20112' THEN
valid data <-- false
Write id#, empfirstname, emplastname, st.address, zipcode, jobcode, 'Zipcode must be 20175, 20132, 20164, 20165, 20113, or 20112'
ENDIF
IF jobcode < 10 and jobcode > 19 THEN
valid data <-- false
Write id#, empfirstname, emplastname, st.address, zipcode, jobcode,'Job description code must be b/w 10 and 19 inclusive.'
ENDIF

IF valid data = true THEN
IF zipcode = '20175' THEN
city <-- 'Leesburg'
state <-- 'Virginia'
20175 count <-- 20175 count + 1
ELSE
IF zipcode = '20132' THEN
city <-- 'Purcellville'
state <-- 'Virginia'
20132 count <-- 20132 count + 1

ELSE
IF zipcode = '20164' THEN
city <-- 'Ashburn
state <-- 'Virginia'
20164 <-- 20164 count + 1
ELSE
IF zipcode = '20165' THEN
city <-- Potomac Falls
state <-- Virginia
20165 count <-- 20165 count + 1
ELSE
IF zipcode = '20113' THEN
city <-- Clinton
state <-- Maryland
20113 count <-- 20113 count + 1
ELSE
city <-- Camp Springs
20112 count <-- count + 1
ENDIF
ENDIF
ENDIF
ENDIF
ENDIF

IF jobcode = '10' THEN
jobtitle <-- 'Desk Clerk'
hrly$ <-- 19.00
job 10 count <-- job10count + 1
ELSE
IF jobcode = '11' THEN
jobtitle <-- 'Credit Checker'
hrly$ <-- 19.00
job 11 count <-- job11count + 1
ELSE
IF jobcode = '12' THEN
jobtitle <-- Billing
hrly$ <-- 19.00
job12count <-- job12count + 1


Also Here is the defining diagram I came up with:

INPUT
id#
empfirstname
emplastname
st.address
zipcode
jobcode


PROCESSING
-prompt use for employee data
-read employee data
-display employee information
-determine hourly pay
-determine job title
-determine location infromation
-determine statistics

OUTPUT
id#
empfirstname
emplastname
st.address
city
state
jobcode
jobtitle
hrly$
counts

Can someone please help me? Examples very similar to this one could help. This assignment is due Thursday, July 1st.

If I could have an example of the output, that would be helpful in trying to help you :P . Although it looks really simple. You put the whole code in a while loop which ends if the value is 0. I just need an example of what the output of this program will look like.

Thanks.

The output is pretty much suppose to like a table like you know teachers plug in grades? it's liek that each person has its own row of grades? That's pretty much how the output should be. Each employee should have his/her row of information outputted (zip code, job code, etc.)
I hope that helps you in helping me :)

oh so its pretty much like a database? (Thats what I'm thinking.)

This is how I would design the program:
Create a main menu which gives the user an option to 1) Add employees 2)View Employess.

If he wants to add employees then in a while loop (where the stopping condition is 0) I will continue asking employee info and storing them in an array (they have to be stored somewhere!). As for the postal code, you just make an if-else if ladder.(I suggest you look these up along with other decision control statements) When he enters 0, he will be taken back to the main menu where he can choose to see the info. The information will be formatted as follows -

ID NAME St. Address City State JobCode JobTitle Hrly$ Counts
---------------------------------------------------------------------------------
and the info goes here......

And then he is shown the menu again. If there was an option to delete, this would be a perfect database kind of thing :P


Anyhow. I shall make the pseudocode tomorrow if you want. Im just too tired and really tired right now :P I'll get it to you before July 1st :) BUT that does not mean that anyone else reading this should not bother helping out :P enjoy the anticipation :P

Also, do you have a particular programming language in mind? (The pseudocode remains pretty much the same, just one or two changes here and there when you go from language to language)

Oh ok, yea i was like going around in circles with this whole thing, but yea thanks for the help, i def. need to learn and understand more about pseudocodes!

planning out the program is actually the hardest stage :P Pseudocode is a plan... the plus side is that it saves you time when you are actually writing the program, the down side is that it drives you nuts if you cant figure out how to go on about stuff :P Anyhow. I think the hardest part of your program would be the formatting.

Would it be ok if I just wrote 'Output the information in a well formatted manner' in the pseudocode? If it is not, I don't mind. Im bored out of my mind, this could actually be brain teasing :P I might actually end up writing the actualy program :D (I have done this kind of thing before.. but just not this... extreme. just some simple array printing.)

well i don't have to write the program yet, lol i just have to do the Pseudocode and i'm still struggling at the planning stage, which is sad but i guess i have to study harder! lol

where/what are you studying? (ETA to Pseudocode: 3 hours)

START PROGRAM

Declare variables for arrays(storing input values), counting (for each postal code and Job code) and input.

Prompt user to input the employee data for first employee (ID, Name, Address, etc.)

		
		IF zipcode = 20175  
		{
			city is leesburg
			state is virginia
			increase postlcode count by 1
		}
		ELSE IF zipcode = 20132  
		{
			city is purceville
			state is virginia
			increase postlcode count by 1
		}
		ELSE IF zipcode = 20164  
		{
			city is ashburn
			state is virginia
			increase postlcode count by 1
		}
		ELSE IF zipcode = 20165  
		{
			city is potomac falls
			state is virginia
			increase postlcode count by 1
		}
		ELSE IF zipcode = 20113  
		{
			city is clinton 
			state is maryland
			increase postlcode count by 1
		}
		ELSE
		{
			city is camp springs
			state is maryland
			increase postalcode count by 1
		}
		
		IF jobcode = 10 
		{
			job title is desk clerk
			hrly$ is 19
			increase job code count by 1
		}
		ELSE IF jobcode = 11
		{
			job title is credit checker
			hrly$ is 19
			increase job code count by 1
		}
		ELSE IF jobcode = 12
		{
			job title is billing
			hrly$ is 19
			increase job code count by 1
		}
		ELSE IF jobcode = 13
		{
			job title is car cleaner
			hrly$ is 19
			increase job code count by 1
		}
		ELSE IF jobcode = 14  
		{
			job title is chauffeur
			hrly$ is 24.50
			increase job code count by 1
		}
		ELSE IF jobcode = 15  
		{
			job title is marketer
			hrly$ is 24.50
			increase job code count by 1
		}
		ELSE IF jobcode = 16
		{
			job title is accountant
			hrly$ is 40.00
			increase job code count by 1
		}
		ELSE IF jobcode = 17
		{
			job title is CEO
			hrly$ is 40
			increase job code count by 1
		}
		ELSE IF jobcode = 18  
		{
			job title is contract
			hrly$ is 85.00
			increase job code count by 1
		}
		ELSE
		{
			no title
			hrly$ is 0
			increase job code count by 1
		}
if (id > 0 and id < 999 and(zip code == 20175 or 20132 or 20164 or 20165 or 20113 or 20112) and job code >= 10 and job code <= 19)
{
	store the value from first prompt and continue
	While (ID is not 0)
	{
		Prompt user for next employee data.
		
		IF zipcode = 20175  
		{
			city is leesburg
			state is virginia
			increase postlcode count by 1
		}
		ELSE IF zipcode = 20132  
		{
			city is purceville
			state is virginia
			increase postlcode count by 1
		}
		ELSE IF zipcode = 20164  
		{
			city is ashburn
			state is virginia
			increase postlcode count by 1
		}
		ELSE IF zipcode = 20165  
		{
			city is potomac falls
			state is virginia
			increase postlcode count by 1
		}
		ELSE IF zipcode = 20113  
		{
			city is clinton 
			state is maryland
			increase postlcode count by 1
		}
		ELSE
		{
			city is camp springs
			state is maryland
			increase postalcode count by 1
		}
		
		IF jobcode = 10 
		{
			job title is desk clerk
			hrly$ is 19
			increase job code count by 1
		}
		ELSE IF jobcode = 11
		{
			job title is credit checker
			hrly$ is 19
			increase job code count by 1
		}
		ELSE IF jobcode = 12
		{
			job title is billing
			hrly$ is 19
			increase job code count by 1
		}
		ELSE IF jobcode = 13
		{
			job title is car cleaner
			hrly$ is 19
			increase job code count by 1
		}
		ELSE IF jobcode = 14  
		{
			job title is chauffeur
			hrly$ is 24.50
			increase job code count by 1
		}
		ELSE IF jobcode = 15  
		{
			job title is marketer
			hrly$ is 24.50
			increase job code count by 1
		}
		ELSE IF jobcode = 16
		{
			job title is accountant
			hrly$ is 40.00
			increase job code count by 1
		}
		ELSE IF jobcode = 17
		{
			job title is CEO
			hrly$ is 40
			increase job code count by 1
		}
		ELSE IF jobcode = 18  
		{
			job title is contract
			hrly$ is 85.00
			increase job code count by 1
		}
		ELSE
		{
			no title
			hrly$ is 0
			increase job code count by 1
		}
		
		Store values in respective arrays.
	}
}
else
{
	write error message.
}
//After the user enters a 0. it exits the while loop and continues.

Print all arrays in a formatted manner.
Print the counts.

END PROGRAM

FINALLY :D Took more time than expected cuz I was trying to reduce the lines. Anyhow. Im off to eat pizza :P

PS. I am not to be blamed for a bad grade on your assignment :P This is the best I can do. If I was going to write the code instead I could have easily got you a 100% on this :P I just hate writing pseudocodes.

Omg dude like its okay i was eating my brain trying to figure this out! Thank you so much i appreciate it! I def owe back for this! Lol don't worry i won't i'm very glad that you were willing to help me! I seriously appreciate it. After this code thing i will need to look at it and try to understand it, hpefully my brain doesn't give up on me lol. Seriously i appreciate that you took time out to help me out thanks a ton!
and enjoy your pizza! :)

lol no probs :) Any other problem, don't hesitate to post cuz you know I'll help :P And I did enjoy my pizza :P btw, you a student?

alright thanks alot! Yea i'm in my first year of college and right now i'm taking summer clases so i can get ahead!

lol nice.if you need help in programming (cuz you are a beginner) you can ask me :) I might not be able to help you all the time tho. I just start 12th grade in september XD

lol alright! Senior year is really fun, it's pretty chill nothing really to worry about. Well, Enjoy your summer and get ready for the senior year! Alright i'm gonna go now, i have a lot of work piled so gotta go finish that up! So ttyl
Btw, Thanks again! :)

please give me complete detail of while loop a problem with pseudocode, defining diagram and flowchart

elena. this is not the place where you can get the answer to your question without even trying. Try it yourself first. tell us how far you have gotten and we shall help you by giving suggestions or hints. But in only very rare cases we give a detailed full answer. I suggest you look around the board and if you need help, start a new thread in the appropriate forum.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.