# Terminalcoffee discussion

52 views
Help! I Need Help! > Pseudocode help, anyone?

message 1: by (new)

I need to tap the TC think tank for a programming class I'm stumbling through like I'm in a medically-induced coma.

Anyone know anything about arrays and pseudocode?

Have at me with the sarcasm and abuse, but I really do have a few questions. Seriously...

message 2: by (new)

So where are the questions?

message 3: by (new)

Problem #1

a. Design the logic for an application for a company that wants a report containing a breakdown of
payroll by department. Input includes each employee’s last name, first name, department number,
hourly salary, and number of hours worked. The output is a list of the seven departments in the
company (numbered 1 through 7) and the total gross payroll (rate times hours) for each
department.

b. Modify a so that the report lists department names a well as numbers. The department names
are:
Dept. Num. Department Name
1 Personnel
2 Marketing
3 Manufacturing
4 Computer Services
5 Sales
6 Accounting
7 Shipping

c. Modify the report created in exercise b so it prints a line of information for each employee before
printing the department summary at the end of the report. Each detail line must contain the
employee’s name, department number, department name, hourly wage, hours worked, gross pay,
and withholding tax.

Withholding taxes are based on the following percentages of gross pay:

Weekly Gross Pay (\$) Withholding (%)
0.00 – 200.00 10
200.01 – 350.00 14
350.01 – 500.00 18
500.01 – up 22

Program #2

a. Daily Life Magazine wants an analysis of the demographic characteristics of its readers. The
Marketing Department has collected reader survey records containing the age, gender, marital
status, and annual income of readers. Design an application that accepts reader data and
produces a count of readers by age groups as follows: under 20, 20-29, 30-39, 40-49, and 50+

b. Create the logic for a program that would produce a count of readers by gender within age group—
that is, under 20 females, under 20 males, etc.

c. Create the logic for a program that would produce a count of readers by income groups as follows:
under \$20,000, \$20,000-\$29,999, \$30,000-\$49,999, \$50,000-\$69,999, and \$70,000 and up.

message 4: by (new)

I'm so glad I was an English major.

message 5: by (new)

At one time I thought I wanted to be a programmer. But after taking courses where they asked you to do stuff like this, I changed my mind.

message 6: by (new)

i never got any further than programming a lego robot, and even that i instantly forgot how to do. it was a pretty cool robot, with sensors and everything, but i only took that class because my favorite uncle is a programmer.

message 7: by (new)

What did the robot do?

I want a lego robot.

message 8: by (new)

A lego robot sounds cool. With sensors and everything.

message 9: by (new)

I'm a database dood, but I gotta take this class for my Master's. Much to my chagrin.

message 10: by (new)

So you want us to help you do the work that will get you a Master's? Hmmmmmmmmmmm.

message 11: by (new)

Proud, me?

message 12: by (new)

Are you looking just to design a report based on an existing DB, or do you need to set up the back end as well?

For example, if you already have the data, then just pull the results you need, one at a time, and add them to your report.

"A" would look something like:

SUM all (RATE*HOURS) WHERE DEPT_NUM=1

"B" is a straightforward modification of the report.

"C" is a matter of printing the data line-by-line as you collect it with your query.

The hard part for me would be the report layout. That's a lot of information to try to include on one page.

message 13: by (new)

if i remember correctly the lego robot could be programmed to take turns before running into something, anything that just required it to take turns and go in straight lines. not that cool, but more exciting than anything else we did in that class. binary and hexadecimal systems are very easy to beat.

message 14: by (new)

In program #2, you need to modify your age ranges so they don't overlap (same for salary ranges).

"A" is the number of records found on a query by age.

SELECT COUNT as total_age FROM 'readers' WHERE age>20 AND age<30

Is that the kind of thing you're needing, or am I way off track?

message 15: by (new)

*wonders if this is where they're handing out cookies*

message 16: by (new)

Yes, it's a start. It's the whole range thing that sort of has me flummoxed, but counts have to initialized to zero so they can be added to during the course of the program.

Thanks, Phil! I'll take it from here.

message 17: by (new)

message 18: by (new)

Yeah, why's it called "pseudocode"? What's the difference between this and real code?

message 19: by (new)

*giggle*

message 20: by (new)

RA has problems with reality.

message 21: by (new)

RandomAnthony wrote: "Yeah, why's it called "pseudocode"? What's the difference between this and real code?"

Huge difference. Pseudocode doesn't have anywhere near the precision of production code. It's basically writing down the algorithm in words that approximate code.

It has been a long time since I've coded anything. I used to be hot shit -- now I'm just an old cow pie. :(