C++ :: Sort Payroll Structures?

Apr 28, 2014

how these structures and arrays work which is why although I added alot more code than given, I sent it into my teacher and he was puzzled with my project. So I brought it back to a payroll calculator unsorted.

Sort the payroll data, and output the data to the file in order by gross pay (lowest to highest)

#include <fstream>
#include <iostream>
#include <cstdlib>

[Code]....

View 5 Replies


ADVERTISEMENT

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

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++ :: Payroll Net Pay With Pointers

May 15, 2014

Alright, after what seems like forever I'm on the last stage of modifying my Payroll Program. This time I have to sort using pointers and I only have to sort the Net Pay category.

Using one of my earlier programs I've removed content from it until it's in a state where it runs but contains no sorting functions.

So now I've to a working program that lacks any kind of sorting and looks like this.

#include <iostream>
#include <fstream>//file input output stream
#include <iomanip>
#include <string>
using namespace std;
//function prototypes
int readalldata(long int id[], string fname[], string lname[], int hoursworked[], float hourlyrate[], int n);

[Code] .....

My hints for how to add pointers to the program are...

int *np,tmp;
for (i=0,i<n; i++) np=&netpay[i]; //associating the netpay to np;
temp=np[i];//storing the pointer to a temp

I've been fooling around trying to sort the Net Pay by pointers using these hints for a bit now and I'm still not getting it.

View 2 Replies View Related

C/C++ :: Payroll Program Net Pay By Pointers

May 15, 2014

My objective is to write a payroll program that among other things sorts the net pay by using pointers. I've already written most the program and have written a working program that sorts the net pay just not by pointers. So What I'll be posting below is my program so far without the pointer sort function.

What I need to do to finish my program is figure out how to add pointers to sort net pay into it.

#include <iostream>
#include <fstream>//file input output stream
#include <iomanip>
#include <string>
using namespace std;
//function prototypes
int readalldata(long int id[], string fname[], string lname[], int hoursworked[], float hourlyrate[], int n);

[Code] ....

View 14 Replies View Related

C/C++ :: Array Of Payroll Objects?

May 20, 2014

Define a PayRoll class that has data members for an employee's hourly pay rate (an integer , representing cents) and number of hours worked (also an integer ). The class provides two member functions, setRate and setHours that assign the value of their parameter to the appropriate data member. The class provides a third member function, getPay, that returns weekly gross pay (in cents), computed as follows: hours times rate for the first 35 hours plus hours times rate times one and a half for any hours past 35.

View 3 Replies View Related

C/C++ :: Overtime And Payroll Calculations

Apr 11, 2014

When you execute my code you'll notice the regular pay for the first example will calculate to $500 when it is only supposed to calculate to $400. I'm also having a problem adding up the totals of the regular pay and overtime pay to get a total payroll which is displayed in one cout statement. 95% of my code is correct, I'm just having these two issues. To make it more clear hear is my assignment:

The regular working hour for an employee is 40 hours a week. Sometimes employees work over time. When the employee works 40 or less hours, the regular pay is calculated as number of hours worked times the hourly rate. When the employee works over time i.e. beyond 40 hours then the employee's pay has two components a) regular pay (40 hours X hourly rate), and 2) overtime pay (the overtime hours beyond 40 X time and half of the hourly rate).

void compute(incomeInfo *ptrI, int count) {                                                
    for (int i = 0; i<count; i++)  
    if (ptrI->hours <= 40) {
        ptrI->regPay = ptrI->hours * ptrI->hRate;
        ptrI++;

[Code] ....

View 1 Replies View Related

C++ :: Void Function To Calculate Payroll

Dec 9, 2014

The purpose of this code is to calculate a pagecheck for intered hours and overtime for any hours over 40! This is what I have so far!

#include<iostream>
using namespace std;
void Amount (int hours, int wage, int sum);
void printCheck(int sum);
int main()

[code]....

View 1 Replies View Related

C++ :: Payroll Program Of A Company That Have At Least 5 Employees

Oct 1, 2014

Make a c++ program of the payroll of a company

input values :
a. Name of Employee
b. Position in the company
c. No. of hours worked
d. No. of overtime hours
e. rate per hour

formula:
basic pay = number of hours worked x rate per hour
ot pay = overtime hours x 150% of rate per hour
gross pay = basic pay + ot pay
tot deduc = tax + sss + med

tax can be computed based on the following table:
basic pay tax
10000 or less 1% of basic pay
10001-15000 2% of basic pay
15001-20000 3% of basic pay
20001-30000 4% of basic pay
30001 or more 5% of basic pay

sss = 10% of basic pay
med = 6% of basic pay

net pay= gross pay - total ded

*The payroll should have at least 5 employees in it.*

View 11 Replies View Related

C++ :: Payroll System - Visualizing Hierarchy

Apr 27, 2014

I have been given a HW to write code for a payroll system. The base class would be Employee. There are four types of employees.

1 - Salaried (fixed salary, no matter the hours)
2 - Hourly (overtime [>40 hours] pays time and half)
3 - Commissioned (paid percentage of sales)
4 - Base-plus-commissioned (base salary + percentage of sales)

Also add a private data member birthDate (a Date object) and departmentCode, an int to class Employee.

1 - Is the following hierarchy that I'm visualizing right? Or is a change needed?

Here is the link: [URL] ....

2 - In hourly, what does in round brackets mean? What is meant by "pays time and half"?

3 - In base-plus-commissioned, is it required to take "base salary" from user or I just get salary from the salaried employee?

View 5 Replies View Related

C++ :: Payroll Program - Calculation Error?

May 22, 2014

I'm working on a payroll program and I'm having problems that are causing calculation errors.

My input file is
1234FredJones4025.00
2345 TerrySmith6010.00

The errors I get are from the regular pay, over time pay, gross pay, tax amount and net pay calculations. They all look similar to this (6e+002). I believe they are occurring because regular pay isn't calculating correctly and the rest depend on that for their calculations. However, I can't see why regular pay isn't calculating correctly.

#include <fstream>
#include <iostream>
#include <iomanip>
using namespace std;
class payroll{
ifstream fin;
char employeeid[100];

[Code] .....

View 14 Replies View Related

C/C++ :: How To Create Payroll System Using Arrays

Feb 21, 2015

Create a payroll program to store and calculate the payroll for a small company with a maximum of 20 employees.

Program parameters are as follows:

1. Create a menu with the following options (use a do-while loop):
A or a to add employee info
D or d to display employee info
T or t to display total payroll
S or s to display the info of all employees
Z or z to exit program

The information for each employee is: employee number, hours worked, pay rate per hour, tax deduction.

2. Use an array of doubles to store employee information.

3. Menu option A or a: ask the user for the employee information one value at . a time and store it in the array.

Please enter employee number: 2190
Please enter hours worked: 32.50
Please enter pay rate: 9.25
Please enter tax rate deduction: 5.50

4. Option D or d: ask the user for an employee number as integer and display . the information for the corresponding employee (cast the employee number

. in the array to integer and then compare). If employee number does not . match, output a msg. indicating "no such employee". If the employee number . is a match, output all the employee information stored in addition to the . calculated deduction and salary.

Output sample:
Info for employee number: 2190
Hours worked: 32.50
Pay rate: $ 9.25
Tax deduction: 5.50 %
Total pay: $ 284.89

5. Option T or t: calculate and output the sum of the total pay of all
. employees.

6. Option S or s: display the information for all employees in the same
. format as in option B.

7. Option Z or z: exit the program.

#include <stdio.h>
#define MAX [20]
int main(void) {
int i;
for (i=0;i<=20;i++) {
char MenuOption=0;
int EmployeeNumber;

[Code] .....

View 1 Replies View Related

C :: Radix Sort Function To Sort Array Of 64 Bit Unsigned Integers

Aug 19, 2013

Example radix sort function to sort an array of 64 bit unsigned integers. To allow for variable bin sizes, the array is scanned one time to create a matrix of 8 histograms of 256 counts each, corresponding to the number of instances of each possible 8 bit value in the 8 bytes of each integer, and the histograms are then converted into indices by summing the histograms counts. Then a radix sort is performed using the matrix of indices, post incrementing each index as it is used.

Code:
typedef unsigned long long UI64;
typedef unsigned long long *PUI64;
PUI64 RadixSort(PUI64 pData, PUI64 pTemp, size_t count) {
size_t mIndex[8][256] = {0};
/* index matrix */
PUI64 pDst, pSrc, pTmp;
size_t i,j,m,n;
UI64 u;

[Code]....

View 9 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

Visual C++ :: Payroll Program Is Showing Zero In Output Section

Nov 25, 2013

The program is showing zero in output section ....

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

[Code] ....

The output:

Code:
First Last Employee Hours Rate Regular Overtime Gross
Name Name Number Worked of Pay Pay Pay Pay
==============================================================
Jane Adams A1234 40.00 10.00 0.00 0.00 0.00
Mary Lincoln L8765 50.00 10.00 0.00 0.00 0.00
Martha Washington W7654 25.50 10.85 0.00 0.00 0.00
John Adams A9876 52.00 15.75 0.00 0.00 0.00
George Washington W1235 45.00 25.00 0.00 0.00 0.00
Abraham Lincoln L9087 40.25 55.00 0.00 0.00 0.00
William Tell T9876 30.00 9.75 0.00 0.00 0.00

View 12 Replies View Related

C++ :: Program To Calculate Company Weekly Payroll - Calling Functions?

Jun 9, 2014

This program in not completed. I am creating a large program in order to calculate a company's weekly payroll. For now I am filling in the separate functions piece by piece before the rest of the program is completed.

Right now I am trying to use separate functions to call other functions. I need to ask the user for the file name and then open the file. I am no longer getting any compiler errors however when I run the program all it displays is "Welcome."

So it's not actually calling the NameTheFile function and the OpenTheFile function. It just says "Welcome" and then closes down. Why is it doing this?

/*Program to determine company's weekly payroll*/

#include <iostream>
#include <string>
#include <fstream>
using namespace std;
void NametheFile() {

ifstream inputFile;

[Code] ....

View 1 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

C/C++ :: Columns In Fstream Data Reading Zero (Array Of Payroll Objects)

Dec 4, 2014

Basically for homework, we gotta make an array of payroll objects, using the general format I've made below...

I'm having trouble. The .dat file we are given to test looks like this:

40.0 10.00
38.5 9.50
16.0 7.50
42.5 8.25
22.5 9.50
40.0 8.00
38.0 8.00
40.0 9.00
44.0 11.75

When I execute the program, it shows the first column of objects, but will always replace the 2nd column values with a 0.

It's definitely NOT reading that column, and using the constructor to set it to zero. I don't know why it's not reading that column though...

(TL;DR.... Currently it reads "Employee #1: 40, 0" rather than "Employee #1: 40, 10.00"... etc)

Here's my code.... (not 100% done yet just testing datafile output atm)

#include <iostream>
#include <fstream>
using namespace std;
class Payroll {
private:
double payRate; // holds an employee hourly pay rate

[code]....

I want it to read the other column without giving me zero />

View 2 Replies View Related

C++ :: Create Simple Payroll Management Application Using Concept Of Binary Tree?

Apr 2, 2013

Create an a simple Payroll Management Application using the concept of Binary Tree. The program will allow you to add, sort, view, search record. The application have also the capability to save and retrieve data in a file.

View 1 Replies View Related

C++ :: How To Sort A 1D Array Using Function Sort

Mar 22, 2013

how to sort a 1D array using function sort().but if i have a 2D array how do i sort only 1 row of it (or column)?

View 2 Replies View Related

C/C++ :: Bubble Sort And Selection Sort?

Feb 19, 2014

You will write a program that uses a multidimensional array having 3 rows and 8 columns and sorts each of the rows using both a bubble sort and a selection sort.

You must declare the array inside of main. You will have a for loop containing the calls to bubbleSort and selectionSort. You need to pass into function bubbleSort and selectionSort the following: 1) each column of the multidimensional array, 2) the size of the column, and 3) a particular row number of the multidimensional array to be used for printing out the "pass" shown on the following pages.

I keep getting an error that the identifier for bubbleSort and selectionSort is not found. (Error C3861) Also, I feel like I'm missing something in int main() to get it to sort properly.

# include <iostream>
using namespace std;
int main()
{

[Code].....

View 14 Replies View Related

C :: Finding Next Day Using Structures

Jul 21, 2013

Ok, for my Sunday homework I have to find the next day of the year using structures. Now, I can get the structure to read the entered date (tested that with a simple scanf to printf entered data), but I need to get it to be able to tell that it is the end of the month and print out the next month when necessary. Here is what I got so far:

Code:
//Cameron Taylor
#include <stdio.h>
struct Date{
int month;
int day;
int year;

[Code] ....

As you can see, I am trying to use an array for the max day of each month (excluding Leap Year for now).

Where I use the entered month to = 'i'. Then I use 'i' as the position in the array to see if next.day is = to the max day of that position of the array.

I am having no compiler issues with GCC using -w or -Wall, but after entering the current day the program stops working and doesn't go beyond the input.

commiedic@localhost Project18$ gcc -o -Wall Exercise4.c
commiedic@localhost Project18$ gcc -o -w Exercise4.c
commiedic@localhost Project18$ gcc -w Exercise4.c
commiedic@localhost Project18$ make Exercise4
make: `Exercise4' is up to date.

[Code] .....

View 13 Replies View Related

C :: Not Using Structures For Project

Apr 5, 2013

I have to do a project for Programming and he said in quotes

"Programming exercise 10.6: the programming project is as described, except do not represent the points using structures.

Assume, as known, the ten (x,y)-values corresponding to x=0.0, 0.1, 0.3, 0.45 ..etc and use y-values from the

function xsin(x); as in (x,y)=(x, xsin(x)) = (0.3, 0.3sin(0.3)).

Use value n+1=10, so the LaGrange polynomial will be order = 9."

What does it mean to not represent the points using structures??

View 2 Replies View Related

C :: How To Print Out Structures Using Loops

Jun 23, 2013

How to print out these structures using loops.. printing out these outputs using loops..

View 5 Replies View Related

C :: Sorting Structures In Database

Nov 26, 2013

A user is supposed to enter student name, id, and grade then sort them by name, id, or grade. I managed to get it to sort by name and id correctly, but not by grade.

Code] .....

#include <string.h>
#include <stdio.h>
struct student{
int student_id;
char name[30];
char grade[15];

[Code] ....

View 8 Replies View Related

C :: Array Containing Pointers To Structures?

Aug 9, 2013

How do I store pointers to a struct in an array ? I am using sprintf to concatenate some values together and then output it to an array in its 1st argument. A portion of my code is shown below.

Code:

int count = 0;
struct addx {
int a;

[Code].....

View 1 Replies View Related







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