Sponsored Content
Full Discussion: Project using awk
Homework and Emergencies Homework & Coursework Questions Project using awk Post 302971664 by gamer9sam on Saturday 23rd of April 2016 10:28:36 AM
Old 04-23-2016
Project using awk

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted!

1. The problem statement, all variables and given/known data:

) Your mission is to create an awk file that will report employee name, state, gross pay, taxes, and netpay in a specific format. The input file has the following fields:Name
State

Pay Rate
Hours Worked
Overtime Hours

There is math involved. The pay rate is the hourly pay rate – different for each employee. Overtime

hours are paid at 1.5 times base rate ((OT Hours * 1.5) Pay Rate). Gross Pay = (Hours Worked +
(Overtime Hours * 1.5)) * Pay Rate. Taxes are computed at 8% (0.08) for State = MO and 7% for State
= KS. Net Pay = Gross Pay - Taxes
The input file is: /home/faculty/hbecker3/projects/p5/payroll
The output should look like the following:

Code:
Name             State
------------       -- 
Sam Smith       MO
Gross Pay:      $1690
Taxes:          $135.2
Net Pay:        $1554.8

(Formatting's a bit off but it needs to be aligned)

[/FONT]
Send me the link to your awk file (I will run it with the awk -f command).


2. Relevant commands, code, scripts, algorithms:

None, just needs to be in an awk format.


3. The attempts at a solution (include all code and scripts):
Code:
Awk BEGIN{
Getline payroll
{NR > 1}
Overtime = ($5 * 1.5) * $3;
GrossPay = ($4 + (Overtime * 1.5)) * $3;
Taxes = {MO|KS , .08|.07}
NetPay = GrossPay - Taxes

{print “Name\tState\n\-------\t--”}
{printf(%.2f\n) “$1\t$2\n\Gross Pay: \tGrossPay\nTaxes: \tTaxes\nNet Pay: \tNetPay} >
project5_q2

4. Complete Name of School (University), City (State), Country, Name of Professor, and Course Number (Link to Course):

Johnson County Community College
Overland Park, KS
United States Of America
Hugo Becker
Course CIS 204 377
CRN: 12520

Note: Without school/professor/course information, you will be banned if you post here! You must complete the entire template (not just parts of it).

Last edited by vbe; 04-23-2016 at 11:41 AM..
 

9 More Discussions You Might Find Interesting

1. Programming

Project Help

hi all. Im not sure whether this is the correct forum to post in, but here goes. I've been given my first year (uni) project c++, a pretty small one really. Problem is I have written a code, but I havent tested or debugged it (dont ask). Can someone check it and correct any errors I have... (1 Reply)
Discussion started by: Shade
1 Replies

2. Programming

a little project i need some help with

Hell everyone, i am trying to write a program for work, i am doing an internship there, where the program will list all the files on the Unix Server(soloaris 9) for all the engineers to look at. The code i have so far works to display all files, but the program also needs to check and see if the... (3 Replies)
Discussion started by: ShenTech
3 Replies

3. Programming

First Project help

People I am a new developer and this is my first project so i need your help.I have completed the connection part of my chat server now i need to develop it further for which i need help from someone so please help me out. (6 Replies)
Discussion started by: arjunjag
6 Replies

4. Solaris

SSH doesn't pick up user's project from /etc/project

We have a system running ssh. When a user logs in, they do not get the project they are assigned to (they run under "system"). I verify the project using the command "ps -e -o user,pid,ppid,args,project". If you do a "su - username", the user does get the project they are assigned to (and all... (2 Replies)
Discussion started by: kurgan
2 Replies

5. Shell Programming and Scripting

awk, shell script reverse engineering app generator - project

Hi, this is fantastic forum for shell programming and scripting, so please let me to introduce you with my very old concept to have web form/s with radio, select, input fields and have an application generating valid, syntax error free scripting code. The same or alike questions are asked... (2 Replies)
Discussion started by: darius2
2 Replies

6. Solaris

what is the use of /etc/project file and project administration commands?

i have two doubts.. 1. what is the use /etc/project file. i renamed this file and when i tried to switch user or login with some user account the login was happening slowly. but when i renamed it to original name it was working fine... why so? 2. unix already has useradd and grouadd for... (4 Replies)
Discussion started by: chidori
4 Replies

7. UNIX and Linux Applications

Need ideas for graduation project based on unix or linux Need ideas for graduation project based on

Dear all, i am in last year of electronics department in engineering faculty i need suggestions for a graduation project based on unix or free bsd or linux and electronics "embedded linux " i think about embedded unix for example or device drivers please i need helps (1 Reply)
Discussion started by: MOHA-1
1 Replies

8. News, Links, Events and Announcements

A new project was posted on The UNIX and Linux Forums project board.

A new project was posted on your project board. Project title: Bash Shell Tutoring Estimated Budget: $50/hr Start date: Immediately Required skills: Linux, Bash, Shell, UNIX I work as a datawarehouse designer and developer. Although I usually stick to the role of an analyst,... (0 Replies)
Discussion started by: Neo
0 Replies

9. Shell Programming and Scripting

FINDING DUPLICATE PROJECT ( directory project )

I have a project tree like that. after running find command with the -no -empty option, i am able to have a list of non empty directory DO_MY_SEARCH="find . -type d -not -empty -print0" MY_EXCLUDE_DIR1=" -e NOT_IN_USE -e RTMAP -e NOT_USEFULL " echo " " > $MY_TEMP_RESULT_1 while... (2 Replies)
Discussion started by: jcdole
2 Replies
mdbFontset(5)							 The m17n Library						     mdbFontset(5)

NAME
mdbFontset - Fontset DESCRIPTION
The m17n library loads a fontset definition from the m17n database by the tags <fontset, FONTSET-NAME>. The plist format of the data is as follows: FONTSET ::= PER-SCRIPT * PER-CHARSET * FALLBACK * PER-SCRIPT ::= '(' SCRIPT PER-LANGUAGE + ')' PER-LANGUAGE ::= '(' LANGUAGE FONT-SPEC-ELEMENT + ')' PER-CHARSET ::= '(' CHARSET FONT-SPEC-ELEMENT + ')' FALLBACK ::= FONT-SPEC-ELEMENT FONT-SPEC-ELEMENT ::= '(' FONT-SPEC [ FLT-NAME ] ')' FONT-SPEC ::= '(' [ FOUNDRY FAMILY [ WEIGHT [ STYLE [ STRETCH [ ADSTYLE ]]]]] REGISTRY [ OTF-SPEC ] [ LANG-SPEC ] ')' SCRIPT is a symbol of script name (e.g. latin, han) or nil. LANGUAGE is a two-letter symbol of language name code defined by ISO 639 (e.g. ja, zh) or nil. FONT-SPEC is to specify properties of a font. FOUNDRY to REGISTRY are symbols corresponding to Mfoundry to Mregistry property of a font. See m17nFont for the meaning of each property. OTF-SPEC is a symbol specifyng the required OTF features. The symbol name has the following syntax. OTF-SPEC-NAME ::= ':otf=' SCRIPT LANGSYS ? GSUB-FEATURES ? GPOS-FEATURES ? SCRIPT ::= SYMBOL LANGSYS ::= '/' SYMBOL GSUB-FEATURES ::= '=' FEATURE-LIST ? GPOS-FEATURES ::= '+' FEATURE-LIST ? FEATURE-LIST ::= '~' ? FEATURE ( ',' '~' ? FEATURE ',' ) Here, FEATURE is a four-letter Open Type feature. LANG-SPEC is a symbol specifying the required language support. The symbol name has the following syntax. LANG-SPEC-NAME ::= ':lang=' LANG Here, LANG is a two or three-letter ISO-639 language code. FLT-NAME is a name of Font Layout Table (Font Layout Table). EXAMPLE
This is an example of PER_SCRIPT. (han (ja ((jisx0208.1983-0))) (zh ((gb2312.1980-0))) (nil ((big5-0)))) It instructs the font selector to use a font of registry 'jisx0208.1983-0' for a 'han' character (i.e. a character whose Mscript property is 'han') if the character has Mlanguage text property 'ja' in an M-text and the character is in the repertories of such fonts. Otherwise, try a font of registry 'gb2312.1980-0' or 'big5-0'. If that 'han' character does not have Mlanguage text property, try all three fonts. See the function mdraw_text() for the detail of how a font is selected. COPYRIGHT
Copyright (C) 2001 Information-technology Promotion Agency (IPA) Copyright (C) 2001-2011 National Institute of Advanced Industrial Science and Technology (AIST) Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License <http://www.gnu.org/licenses/fdl.html>. Version 1.6.2 12 Jan 2011 mdbFontset(5)
All times are GMT -4. The time now is 11:33 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy