Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask C/C++ Expert


Home >> C/C++

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
#include
#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 );
}

C/C++, Programming

  • Category:- C/C++
  • Reference No.:- M92054550
  • Price:- $40

Priced at Now at $40, Verified Solution

Have any Question?


Related Questions in C/C++

Project - space race part a console Project - Space Race Part A: Console Implementation

Project - Space Race Part A: Console Implementation INTRODUCTION This assignment aims to give you a real problem-solving experience, similar to what you might encounter in the workplace. You have been hired to complete a ...

There are several ways to calculate the pulse width of a

There are several ways to calculate the pulse width of a digital input signal. One method is to directly read the input pin and another method (more efficient) is to use a timer and pin change interrupt. Function startTi ...

Question 1find the minimum and maximum of a list of numbers

Question: 1. Find the Minimum and Maximum of a List of Numbers: 10 points File: find_min_max.cpp Write a program that reads some number of integers from the user and finds the minimum and maximum numbers in this list. Th ...

Assignment word matchingwhats a six-letter word that has an

Assignment: Word Matching What's a six-letter word that has an e as its first, third, and fifth letter? Can you find an anagram of pine grave. Or how about a word that starts and ends with ant (other than ant itself, of ...

Software development fundamentals assignment 1 -details amp

Software Development Fundamentals Assignment 1 - Details & Problems - In this assignment, you are required to answer the short questions, identify error in the code, give output of the code and develop three C# Console P ...

Why do researcher drop the ewaste and where does it end

Why do researcher drop the ewaste and where does it end up?

1 implement the binary search tree bst in c using the node

1. Implement the Binary Search Tree (BST) in C++, using the Node class template provided below. Please read the provided helper methods in class BST, especially for deleteValue(), make sure you get a fully understanding ...

What are the legal requirements with which websites must

What are the legal requirements with which websites must comply in order to meet the needs of persons with disabilities? Why is maximizing accessibility important to everyone?

Assign ment - genetic algorithmin this assignment you will

ASSIGN MENT - GENETIC ALGORITHM In this assignment, you will use your C programming skills to build a simple Genetic Algorithm. DESCRIPTION OF THE PROGRAM - CORE REQUIREMENTS - REQ1: Command-line arguments The user of yo ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As