Write a system to read from a file list of employee payroll

Assignment Help C/C++ Programming
Reference no: EM131299902

Assignment

Implement an employee payroll calculator with data modeling (w/ structures) design methods (from the study notes) using the C/C++ programming language. Write a system to read from a file a list of employee payroll information, calculate net salary amounts based on base salary, bonus, and % deduction. Remove salaries from the list based on some specified criteria and print each employee result from the list to the screen.

For this project, you will design your data model as a well-organized data structure in C/C++ and develop a linked list of structures to elegantly implement and operate on a collection of these data objects. Reference the notes entitled "Data structures - linked lists" for help and example code for this project. You may not use any of the STL classes (e.g. vector, list) or a fixed-size array for this project. You must implement a linked list yourself using the example demonstrated in the lecture notes.

Open the following data file on disk containing payroll information for each employee (for information on opening, reading, and closing files, see example code below):

>> Please just use a filler file name, as you cannot access the directory in question.

Each line in the file represents a single employee with four columns of information as follows:

Name BaseSalary Bonus % Deduction

Clark Kent 55000 2500 0.07

Lois Lane 56000 1500 0.06

Tony Stark 34000 2000 0.05

2) Create a data model definition (using a C/C++ struct) to organize and store employee payroll information as discussed in the study notes on data modeling (w/ structures).

3) Upon reading each line, create data structure objects dynamically, store the information, and add to a growing linked list of data structures. You are to read the file under the assumption that you DO NOT know the number of lines in the file ahead of time. Each line must create a dynamic object added to your linked list as in the study notes example.

4) After reading is complete, close the data file.

5) Using a looping statement, cycle through each object in the linked list and calculate the net salary for each employee with the following equations

Deduction = (Base salary + Bonus) * (% deduction)

Net salary = (Base salary + Bonus) - Deduction

6) Remove from the linked list those employee records with net salaries in the following range. You must alter the pointers within the objects of your linked list to skip over employee record objects with net salaries in this range. Using an if statement to simply not print these records does not suffice as removal of an object from the linked list.

45000 < net salary < 60000

7) Print the final list of data objects displaying all information including name, base salary, bonus, deduction, and final net salary in an organized, readable manner to the screen.

8) Comment your code!

Example help given:

If you are unfamiliar with how to open a file on disk, read the information, and close the file, below is an example of how to handle such operations using C system functions (fopen, fscanf, fclose) and C++ file streams to accomplish these tasks. We'll be addressing C++ streams in detail later in the semester.

/* Open a file, read information, close the file
Assume the file (example.txt) contains a single line
with the following contents:
John Doe 10000 */
#include <stdio.h>
#include <stdlib.h>
#define MAX_STR 100
main()
{
FILE *in; /* file descriptor */
char first[MAX_STR]; /* first name */
char last[MAX_STR]; /* last name */
float salary; /* salary */
/* open a file, check for errors */
if( (in = fopen( "example.txt", "r" )) == NULL )
{
printf( "Error opening file\n" );
exit(1);
}
/* read from the file:
note that since first and last are arrays,
the array name is ***** ***** address of the first
element of the array (first == &first[0])
Note also that fscanf returns the number of items
successfully read */
int nread = fscanf( in, "%s %s %f", first, last, &salary );
/* print information */
printf( "Name: %s %s\n", first, last );
printf( "Salary: %f\n", salary );
/* close the file */
fclose( in );
}

Reference no: EM131299902

Questions Cloud

What rate of return should jacobs require on a project : What rate of return should Jacobs require on a project of average risk?- If a new venture is expected to have a beta of 1.6, what rate of return should Jacobs demand on this project?
Write a program that design a class named month : Design a class named Month . The class should have the following private members: name A string object that holds the name of a month, such as "January," "February," etc.
Main types of linux commands : Which of the following is not one of the three main types of Linux commands?
Create a text file with one record of text data : Create a text file with one record of text data. This text file will be read by the program and the data in the text file will serve as a search term.
Write a system to read from a file list of employee payroll : Write a system to read from a file a list of employee payroll information, calculate net salary amounts based on base salary, bonus, and % deduction.
What is the current market price of these bonds : Western Enterprises' bonds have 10 years remaining to maturity. Interest is paid annually, the bonds have a $1,000 par value, and the coupon rate is 9 percent. The bonds have a yield to maturity of 7 percent. What is the current market price of th..
What is the post merger eps : Calculate the merger premium and the exchange ratio:- What is the post-merger EPS?- Is there any evidence of dilution of ownership or earnings in either merger transaction?
Prepare the budgets for june : Prepare the budgets for June Revenue, Production, Material usage and Material purchase ( how many pounds of material should be purchased and what is the cost of purchases)
Quality of digital video output : Identify and explain the three factors that influence the quality of digital video output.

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Create program that uses functions and reference parameters

Create program that uses functions and reference parameters, and asks user for the outside temperature.

  Write a program using vectors and iterators

Write a program using vectors and iterators that allows a user to maintain a personal list of DVD titles

  Write the code required to analyse and display the data

Calculate and store the average for each row and column. Determine and store the values for the Average Map.

  Write a webservices application

Write a webservices application that does a simple four function calculator

  Iimplement a client-server of the game

Iimplement a client-server version of the rock-paper-scissors-lizard-Spock game.

  Model-view-controller

Explain Model-View-Controller paradigm

  Design a nested program

How many levels of nesting are there in this design?

  Convert celsius temperatures to fahrenheit temperatures

Write a C++ program that converts Celsius Temperatures to Fahrenheit Temperatures.

  Evaluate and output the value in the given base

Write C program that will input two values from the user that are a Value and a Base with which you will evaluate and output the Value in the given Base.

  Design a base class shape with virtual functions

Design a base class shape with virtual functions

  Implementation of classes

Implementation of classes Chart and BarChart. Class barChart chould display a simple textual representation of the data

  Technical paper: memory management

Technical Paper: Memory Management, The intent of this paper is to provide you with an in depth knowledge of how memory is used in executing, your programs and its critical support for applications.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd