Showing posts with label review. Show all posts
Showing posts with label review. Show all posts

Tuesday, December 6, 2011

Finishing Projects

For projects 8 and 9, we need to get input for 6 employees and return a formatted list for a payroll sheet.

                In pseudo code (not actual code), this goes something like:
            Create a temp file containing the headings (number, name, rate, hours, etc)
                (echo "Number Name Rate...etc" > temp)
            Create a total variable to store overall total pay for all employees
            While loop for 6 passes
                read number name rate hours overtime
                regularpay=rate*hours
                overtimepay=rate*overtime
                totalweeklypay=regularpay+overtimepay
                total=total+totalweeklypay
                store variables as a new line in temp file
                    (number name rate hours overtime regularpay overtimepay totalweeklypay >> temp)
            done with while loop
            echo “Weekly Payroll”
            use awk to format each line from the temp file                                awk '{printf "%-6s%-13s%-10s%5s%8s%10s%9s%8s%8s\n", $1, $2, $3,"$"$4, $5, "$"$6, "$"$7, "$"$8, “$”9}'        (you may need to edit the %numbers)
            echo “Total: \$$total”

Also, to make this work for reading from a file for project A, try adding “< $1” after the “done” in the while loop.  This takes the first parameter passed at the command line and uses it as the file entry for the read command.

That gets you through project B, actually, since the AWK command is all that’s needed to complete it.  As for “discount”, that’s a new script, and can be found entirely in the student manual, under page 34 or 35 I believe.

Good luck, acolytes!

Tuesday, November 8, 2011

Review Time!

I found a few articles that may be useful.  First up is "Learn UNIX in 10 minutes."  It seems pretty decent, and goes over pretty much everything we have learned so far:

http://freeengineer.org/learnUNIXin10minutes.html

Next up, here's a tutorial for beginners, with lesson plans and screen shots.  Not much beyond what we've learned so far, but good for review:

http://www.ee.surrey.ac.uk/Teaching/Unix/

From that site, we find a link to recommended books.  From what I've found, these are the best ones out there, and are recommended on many Unix sites and forums:

http://www.ee.surrey.ac.uk/Teaching/Unix/books-uk.html

Now for another rare find: a free book on Unix from 1993, "Unix is a four letter word."  It's an interesting read, covers a pretty thorough history of Unix and commands, and has a touch of geek humor.  Okay, so it's 18 years old, and dates back before the Internet, but I find it valuable enough to read it, so maybe you will, too:

http://unix.t-a-y-l-o-r.com/index.html

See you at the midterm!

-Jason

EOF