Objectivein this assignment you read a list of employees

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

Objective

In this assignment, you read a list of employees from a CSV file and convert them into corresponding objects. Note that, unlike Lab 4, the CSV file contains more than one type of Employee. In addition to a StudentEmployee, we also have ClassifiedStaff and Faculty that extend our base Employee. Each employee has different information (described more in the UML diagram). Let's take a look at the CSV as it appears in Excel (note: color added to distinguish between Employee types):

52_Untitled.png

In green, we have StudentEmployees. In red are examples of ClassifiedStaff. Finally, the blue contains Faculty. Note the subtle differences between each Employee type. ClassifiedStaff have one less column. StudentEmployee's last column contains a double whereas Faculty's last column contains a string. You will need to use these differences when converting from CSV into the appropriate object-type.

Obtaining the Correct Object-type

Speaking of converting into the correct object-type, this assignment also introduces you to the classic design pattern known as the Factory. The goal of the factory is to abstract away object creation. Doing so allows us to create more generic code that can be used in a wider variety of circumstances. In our situation, our factory will accept a line from the CSV, convert that line into a pointer of the appropriate class (StudentEmployee, ClassifiedStaff, or Faculty), and return that instance of that class back to the main function.

UML Diagram

2285_Untitled.png

Here's a complete UML diagram of all the classes that you'll need to create:
Employee and its Derivatives
Most of the Employee and its derivative class' methods should be self-explanatory as they're mostly just basic getters and setters. However, I will comment on the class constructors and the two virtual function.
Class Constructors
In order to promote code reuse, derivatives of Employee should call Employee's base constructor. We've talked about how to do this in class, but here's a basic example:
StudentEmployee( <paramters here>)
: Employee( <pass parameters to employee> )
{
//initialize variables specific to StudentEmployee here.
}
The getWeeklyPay Method
the getWeeklyPay() method is calculated differently based on the derived class:
? For StudentEmployees, you get the weekly pay by multiplying their hours worked by their hourly wage
? For ClassifiedStaff, simply return the weekly salary
? For Faculty, return their yearly wage divided by the number of weeks that they work
The toString Method
Like reusing the base class' constructor, you should also aim to reuse the base class' toString() method. To do so, simply call Employee::toString() in your overridden method. The format for each toString() is shown in the sample output section.

Sample Output
Below is sample output from my program:

2491_Untitled.png

Note that only people presently working are displayed in the "Next Paycheck" area. In my case, Ezra Brooks isn't working so he isn't displayed in the paycheck section.
Header Comment, and Formatting
1. Be sure to modify the file header comment at the top of your script to indicate your name, student ID, completion time, and the names of any individuals that you collaborated with on the assignment.
2. Remember to follow the basic coding style guide. A basic list of rules can be found on OSBLE.

Reference no: EM13347352

Questions Cloud

Rc circuitsnbsp1 hand calculate the expression for the : rc circuitsnbsp1 hand calculate the expression for the voltage and current of the capacitor and plot these equations by
Reading assignments - read and have a good understanding of : reading assignments - read and have a good understanding of mil-std-499 and mil-std-499a. be sure that you have
Prepare a project summary that includes the following an : prepare a project summary that includes the following an overview of the projects objectives and scopea list of tasks
Many bridge designs today contain simple geometrical : many bridge designs today contain simple geometrical components but are constructed into complex ways to ensure that
Objectivein this assignment you read a list of employees : objectivein this assignment you read a list of employees from a csv file and convert them into corresponding objects.
Using a dfd and a processing narrative explain computer : using a dfd and a processing narrative explain computer based system that will distinct transform flow characteristics.
Prepare a presentation on what is required to have the best : prepare a presentation on what is required to have the best members club some activities already includepool group
This is a significant task that needs forward planning and : this is a significant task that needs forward planning and adequate time for research reading and reflecting. you
1 what are the different applications of data structure2 : 1. what are the different applications of data structure?2. what are the basic limitations of linear array?3.

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Declare a 1-dimensional array of integers

In pseudocode and in C code, declare a 1-dimensional array of Integers called InternetHits that will hold up to 10 Integer values representing the number of hits a Web site receives.

  Write a function named dietoss that simulates the tossing

Write a function named dieToss that simulates the tossing of two dice. When you call the function, it should generate two random numbers ranged in 1 to 6 and return the sum of the die's numbers. In the mail program, ask user how many times the dice s..

  Create an array of customer names

In preparation for more complex data processing tasks using object-oriented objects that you will create in up-coming units, in this unit you will utilize arrays to build some basic processing logic and structures.

  Write a function name is prime

Write a function name is Prime, which takes an integer as an argument and returns true if the argument is a prime number, or false otherwise. Demonstrate the function in a complete program.

  Sockets for this problem you will implement a client-server

sockets for this problem you will implement a client-server version of the rock-paper-scissors-lizard-spock game which

  Write statements that assign random integers to the variable

Write statements that assign Random integers to the variable n in the following ranges.

  Write a c program that reads in five numbers

Q1. (Bar Chart /Histogram printing) Write a C program that reads in five numbers (each between 1 and 30). For each number read, your program should print a line containing that number of adjacent asterisks. For example, if your program reads the numb..

  Hypothetical method lock over an object lock

Imagine a hypothetical version of Java where the object lock is replaced by a method lock. Under this system a call to a synchronised method would assign a lock for that method to the calling thread.

  Businesspartner class that contains a first name

Create a BusinessPartner class that contains a first name, company name, and a telephone number. Create a Contacts class that contains a dynamically allocated array of BusinessPartners as well as the owner's name and cell phone number.

  Wrtie a function called gen_rand_double_array

Wrtie a function called gen_rand_double_array that generates 900 samples of size 22500 random numbers from U(10, 12). For each of these 900 samples, write a main funciton that calculates the mean and finds the simulated probability that the mean is b..

  Write short c program to develops two processes

Write down a short C program which develops two processes. Each process must repeatedly write its own unique message to test file, one character at time. Do you see garbled messages in the file? Explain why or why not?

  You are the admissions office at abc medical university

You are the Admissions Office at ABC Medical University. You have a large number of applicants for a very few number of available openings at your school. As a result, you need to set some high admission standards. To be accepted, a student ..

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