C/C++ :: Program That Will Read Gross Salary Of Employee And Calculate Net

Sep 14, 2012

I have tried different programs and nothing works for this.Write a program that will read the gross salary of an employee and calculate the net

View 1 Replies


ADVERTISEMENT

C/C++ :: Writing Program That Will Calculate Employee Salary?

Jan 31, 2014

I am having some trouble with my class assignment. We need to write a C program that will calculate the employee salary. There are 5 employees that will need to be calculated. We are required to use a loop also.

So far this is what I have but I am receiving errors when running the program.

#include <stdio.h>
int main() {
int clock_num; /* employee clock number */
float gross; /* gross pay for week (wage * hours) */
float hours; /* number of hours worked per week */
float wage; /* hourly wage */
/* Prompt for input values from the screen */
printf ("This is a program to calculate gross pay.

[code]....

View 3 Replies View Related

C/C++ :: Program Using Multiple Functions That Will Calculate Salary?

Feb 21, 2014

I already wrote a program that will calculate the gross pay for a set of employees.

I want modify the code by adding multiple functions.

I want to create a separate function whenever possible to break up the program.

For example, I would like have a function for obtaining the hours from the user, another function for calculating overtime hours, another for calculating gross pay and another function for producing the output.

#include <stdio.h>
#include <stdlib.h>
#define STD_HOURS 40.0
#define OT hour>STD_HOURS
#define SIZE 5
int main() {
int clockNumber[SIZE] = {98401, 526488, 765349, 34645, 127615}; /* employee ID */

[code]....

View 2 Replies View Related

Visual C++ :: Calculate Amount Paid To Employee Based On Hours Worked And Rate Per Hour

Oct 8, 2013

Write a program in C++ that calculates the amount to be paid to an employee based on the hours worked and rate per hour. A user will enter hours worked and rate per hour for an employee. Your program should have a function payCheck that calculates and returns the amount to be paid. The formula for calculating the salary amount is as follows: for the first 40 hours, the rate is the given rate (the rate that a user has entered); for hours over 40, the rate is 1.5 times the given rate.

I had write my own coding, but it keeps error. it is okay. But i still don't think i could share here? Still running... I will update my coding for you alls to check for any syntax or logic error. The problem is i need to calculate if the employee work for more than 40 hours which 1.5 times.

Code:
#include <stdlib.h>
#include <stddef.h>
#include <string.h>
#include <stdio.h>
#include <iostream.h>
using namespace std;
int main(void) {
char *empname, *test, *final_output;

[Code] .....

View 7 Replies View Related

C++ :: Program To Take Number Of Hours Worked And Output Workers Gross Pay

Sep 21, 2014

ok so i did a program that will take the number of hours worked in a week annd the number of dependents ans inputs and then outputs the workers gross pay, each withholding amount, and the net take home pay per week.

The Program should come out as this:

Regular Hours :34
Overtime hours: 0
gross pay : $323.00
social tax: 19.38
federal tax: $45.22
Statte tax: $16.15
Number of dependents covered: 2
additional health insurance expence: $0

Net take home pay: $236.25

The employer pay rate is 9.50
the employer worked 34 hours "regular hours 40 or less"
if any hours are paid at over time rate of one and one half time that from the gross pay, 6% of social is with held, 14% form federal income, 5% from state income, 6$ per week from union dues, and if worker has 3 or more covered dependent, then an additional 10$ is wothheld to cover the extra cost of health insurance

heres my program:

#include <iostream>
using namespace std;
int main () {
int regHours; // Regular Hours
float hourlyPay, gross, otime, socialtax, federaltax, statetax, uniondues, dep, health; // gross income, overtime, social tax, federal tax, state tax, union dues, depen covered, health insurance

[Code] .....

the program runs but theres still errors in it, it did not make some of the calculations right.

What formula do I use to calculate overtime hours if there was over time?
What formula do I use to take out union dues from total income?
How to I set the number of independents covered to match the health cost if it was 3 or more?

View 1 Replies View Related

C# :: How To Autogenerate Employee Id When User Enters Details Of Employee

Jul 4, 2013

I want to autogenerate employee id when user enters details of employee

Conditions:

User Selects Department which should be used as prefix.

A new Sequence of numbers must be generated for each department

Example:
DeptA0001
DeptA0002
Again DeptB new seuquence must be started
DeptB0001
DeptB0002...

View 3 Replies View Related

Visual C++ :: Employee Payroll - Read Data From Text File And Sort

Nov 11, 2013

i tring to write a employee payroll code with functions and read data from the txt. file and also bubble sort that sorts and displays starting from employees last name and calculations.

//txt file//
Hours Pay rate empID first name last name
40.0 10.00 A1234 Jane Adams
50.0 10.00 L8765 Mary Lincoln
25.5 10.85 W7654 Martha Washington
52.0 15.75 A9876 John Adams
45.0 25.00 W1235 George Washington
40.25 55.00 L9087 Abraham Lincoln
30.0 9.75 T9876 William Tell
42.5 12.50 M7654 Missy Muffett
30.0 10.00 P8765 Peter Piper

and here is my code

Code:
#include <iostream>
#include <cstdio>
#include <fstream>
#include <string>
#include <iomanip>
using namespace std;
const int SZ = 55;
void tellUser();

[Code] .....

here are the errors the are giving

Code:
payroll.cpp: In function "int bubbleSort()":
payroll.cpp:52:8: error: "lastpos" was not declared in this scope
payroll.cpp:52:18: error: "numemp" was not declared in this scope
payroll.cpp:56:10: error: "swapmade" was not declared in this scope
payroll.cpp:57:16: error: "i" was not declared in this scope

[Code] ....

View 14 Replies View Related

C++ :: Program For Calculating Overtime Payment Of Employee?

Jun 4, 2013

refer to this image: [URL]

program for calculating overtime payment of an employee?

View 11 Replies View Related

C/C++ :: Employee Payroll Calculations Program For A Class

Sep 30, 2013

getting output from my code when I compile, the codeblocks ide doesnt show any errors it just doesn't give me any out put when I compile?

Here is my code:

#include <iostream>
#include <string>
#include <iomanip>  
using namespace std;  
//
//CLASS DECLARATION SECTION

[code].....

View 1 Replies View Related

C++ :: Adding Employee Names In Function Arranged Program

May 13, 2014

The program that I have written below is working. It calculates a number of payroll type variables and most recently the net pay average (All this is working 100%).

My problem is that I need to add first and last employee names to the program but every time I do this I end up ruining the working program. I've successfully added first and last names to similar programs in the past(ones that make use of an array and while loop) but never to a program that uses functions (I always have problems doing this).

My question is what codes do I use to add a first and last name variable and where do I put those codes within my program so it runs/displays correctly.

I think the coding must be similar to what I've used in the past charr and of course firstname[i] and lastname[i] lines.

Current Input File:
16454025.00
89324020.00
71044012.50
28164026.00
53874021.00
67804013.50
56414011.25

90006025.00
90015020.00
90025523.00

Ideal input file (would include names) Example.
1645 Bob Smith 40 25.00

Syntax:

#include <iostream>
#include <iomanip>
#include<fstream>
using namespace std;
//function prototypes
int readalldata(long int[], int[], float[], const int);
void findovertimehours(int[], int[], int);

[Code] .....

View 8 Replies View Related

C++ :: Payroll Program - Number Of Hours An Employee Worked / Pay Rate

Oct 5, 2014

Write a payroll program that prompts for the number of hours an employee worked, as well as the employee’s pay rate. If the employee worked for 40 hours or less, the gross pay is calculated by multiplying the number of hours worked by the pay rate. If the number of hours worked by the employee exceeds 40 hours, the employee should receive regular pay for the first 40 hours, and receive time-and-a-half pay for the hours in excess of 40. Display the calculated gross pay on the screen.

Continue to prompt for similar data for more employees and have the gross pay of each employee displayed, until there is no more employee data to process. Then display “Good Bye”.

Your solution must be separated into three source files (Interface, Implementation, and Test)

View 3 Replies View Related

Visual C++ :: Employee Payroll Program Using Structures Does Not Show All Data

Dec 11, 2013

I am writing a employee payroll program using structures. My program is running but its only showing some of the data.

HERES MY CODE

Code:
#include <iostream>
#include <cstdio>
#include <fstream>
#include <string>
#include <iomanip>
#include <cstring>
using namespace std;
const int SZ = 20; // size of arrays to hold scores
struct payrollStruct {

[Code] ....

And it doesn't show anything from txt file

Code:
40.0 10.00 A1234 Jane Adams
50.0 10.00 L8765 Mary Lincoln
25.5 10.85 W7654 Martha Washington
52.0 15.75 A9876 John Adams
45.0 25.00 W1235 George Washington

[Code] .....

View 14 Replies View Related

C++ :: Salary Column Output Zero

Feb 21, 2014

void calcWeeklyPay(double empData[][COLS], const int count) {
double wage;
double hour;
int row;
for (row = 0 ; row < count; row++); {
hour = empData[row][0];
wage = empData[row][1];

[Code] ....

I'm really stuck on this problem...Why is it in my salary column all it outputs its 0? How would i fix this ?

View 2 Replies View Related

C++ :: Calculating Gross Pay - Arrays

Dec 4, 2013

I am just learning arrays, I modified my program to use arrays but now it wont calculate the gross pay well it seems it does but not correctly. The gross pay is coming back as "-9.25596e+061" it worked fine before I added arrays. I do have a text file with the following input :

John Doe 1404 45 20 H
Bobby Jill 1404 45 20 S

#include <iostream>//including library (directive header file)
#include <windows.h>//makes console look pretty
#include <fstream>//Library to read files
#include <iomanip>
using namespace std;
int main() {
SetConsoleTitleW(L"Payroll System");//Set Console Title

[Code] .....

View 2 Replies View Related

C++ :: Net Pay By Pass Referencing A Gross Pay Overloaded Function

Oct 23, 2014

I need to return taxes paid and net pay by pass referencing a gross pay overloaded function. Are the values returned from calling the overloaded function file stream objects? Can they be passed simply through a pass-by-reference function?

//Read Data from File, gather info and calculate pay, output data to file
while(counter < x) {
inFile >> last_name >> first_name >> hours_worked >> hourly_pay;
outFile << first_name << " " << last_name << " ";
outFile << calculate_gross_pay(hours_worked,hourly_pay);
counter++;
outFile<<endl;

[code].....

View 8 Replies View Related

C++ :: Find Total Gross For Department Entered

Apr 24, 2013

I am trying to find total gross for department entered but it keeps giving me a total gross for every department and I don't want that. I think its maybe just one word I am missing but not sure. Here's my code

// display record by searching by dept number
void searchByNumber(Staff s[] ,int row) {
double GrandTotalPay=0.0;
clrscr();
cout << "this is Search

[Code] ....

View 2 Replies View Related

C++ :: Read List Of Random Numbers From Input File And Calculate Statistics?

Nov 11, 2013

I need my program to read a list of numbers from and input file, random.txt, and calculate the following statistics on those numbers:

A. The number of numbers in the file.
B. The sum of all the numbers in the file.
C. The average of all the numbers in the file.
D. The largest number in the file.
E. The smallest number in the file.

#include <iostream>
#include <fstream>
#include <iomanip>
#include <string>

[Code]......

This is what I have so far but I'm not sure if it is right. I can't get the input file to open.

View 3 Replies View Related

C++ :: Program To Calculate BMI

Oct 7, 2013

I'm trying to successfully run a program that calculates your BMI but, although it runs, it is not giving the the correct math. Instead, it gives me the number i've submitted as my weight as an answer. I'm using Visual Studio 2008 and the formula: weight / (height/100)*2

Here is my code

#include <iostream>
#include <cmath>
using namespace std;
int main() {
int weight;
int height;
double BMI;

[Code] ....

View 2 Replies View Related

C :: 6 Structure Array For Employee Pay

Jul 23, 2013

Ok, so this assignment is to create a structure that allows input for up to 6 employees that then makes a 6 structure array showing Employee ID, Employee Last Name, Employee Pay Rate, Employee Hours Worked, Employee Pay, and Total Gross Pay for All Employees.

I don't have a printf yet for total gross, but right now I am just trying to tackle the input. Obviously I am not doing it right because although gcc complier is not giving errors the program is not ending when I type 'q' (sentinel issue) or when I reach 6 employees. It just continues input forever. Here is my code so far:

Code:
//Cameron Taylor
#include <stdio.h>
#define MAXARRAY 6
struct Record{
int idnum;
char lname[20];
double pay_rate;

[Code] ........

View 9 Replies View Related

C++ :: Program To Calculate Fractions?

Oct 24, 2013

I need to write a program that can calculate fractions.

View 2 Replies View Related

C++ :: Program That Calculate Discounts

Nov 8, 2013

So my midterm exam for programming is done. My program didn't run. Tried rewriting it once I got home. I am still getting an error that the program could not be run. Also, we weren't allowed to use the internet. So I didn't know how to calculate for the discounted rate.

I am using Microsoft Visual Studio 2010.

Given problem:

ABC Hotel offers 5-10% discounts depending on how much money has the user spent. If item purchase is lesser than 1000php (1USD is 43.19PHP) 5% discount is availed. Greater than 1000php then 10% discount is availed. Total price and discounted price should be displayed.

#include<iostream>
using namespace std;
main() {
float a,b,c,d,e,f,g,h,i,j,total,discounted_price;
cout<<"Please input price of first 1st item: ";

[Code] .....

View 1 Replies View Related

C/C++ :: Enter And Store Employee Objects

May 17, 2014

Okay, I'm not entirely certain where my code is messed up, but when I run the console it asks if I want to add Employee information and then it just skips through everything when I say yes.

#include <iostream>
#include <iomanip>
#include <string>

[Code].....

View 14 Replies View Related

C :: Calculate Offset Of Simple Program

Sep 28, 2013

I would to learn how could i calculate the offset of simple c program?

Lets say that I have that simple program:

Code:
#include <stdio.h>
int main() {
int x=1;
printf("x = %d", x);
return 0;
}

View 9 Replies View Related

C :: How To Write A Program That Will Calculate Stress

Feb 7, 2013

I recently signed up for ES201 class and am confused with how to compile a program in the C language that will convert ACT scores to SAT scores.

View 5 Replies View Related

C :: Program That Will Calculate Strain Of Object

Feb 7, 2013

The equation for strain is:

delta(x)/x_0
delta(x) is the change in length of the rod(final length - initial length) x_0 is the original length of the rod

I'm trying to figure out how to write a program that will calculate the strain of an object, given its initial length and final length.

View 2 Replies View Related

C :: Program To Calculate Difference In Time?

Nov 6, 2014

i writing a code which will calculate the difference between time_in and time out. Can i use a 2 dimensional array for example

int time_in[hours][minutes]
int time_out[hours[minutes]

View 3 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved