Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Read in employee information from a file and store in a structure using dynamic memory. C++ ONLY. I've tried doing this on my own and

Read in employee information from a file and store in a structure using dynamic memory. C++ ONLY. I've tried doing this on my own and couldn't get it working. I posted already but think my code might be too confusing as it is so I'm trying without the code if anyone can give it a shot so I know what's going on. I know how to read in the information but can't get it to where it's storing the data in the structure using dynamic memory. Any help is appreciated :) ** You don't have to split it up in different files, all in one is fine. I just need help understanding this project.

  • Create and use an enum
  • Create and use a struct
  • Mix dynamic memory with struct
  • Do not use dynamic arrays, assume no more then 100 structs in the array
  • Do not use complex file input, it is simple to read data
  • For this program you must create the following files in your project

  • main.cpp - contains only the main function
    • Main will mostly call other functions to do the work
    • It should be easy to see, from a high level, what the program does
  • employee.h - a header file with the declaration of your data types and functions
  • employee.cpp - contains the implementation of your functions
  • The functions you must include

  • a function to create a new instance of your data structure
    • NOTE: This function does not read the data from the input file, pass it in as parameters
  • a function to calculate (process) the data
  • a function to print your report
  • a function to cleanup any memory allocated in your create function
  • any other functions you think you should add
  • In short, this program will read the input data of:

  • a first name
    • The buffer to read the name should be at least 100 characters
    • The struct MUST use new to allocate memory to store the name in
  • a decimal number for their rate of pay
  • a decimal number for the number of hours worked
  • a letter representing the type of employee they are
    • F is full time
    • P is part time
    • The structure MUST use an enum to store this information
  • The calculation done is to calculate how much pay is needed for the given person:

  • Pay rate times the number of work hours
  • If the person is full time
    • Deduct $5.00 for Union dues

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Informix Database Administrators Survival Guide

Authors: Joe Lumbley

1st Edition

0131243144, 978-0131243149

More Books

Students also viewed these Databases questions

Question

Create a workflow analysis.

Answered: 1 week ago