CS 570: Programming Foundations Homework Assignment #8 Solved

30.00 $ 15.00 $

Category:

Description

Note: This and all assignments given in this course can be and must be solved using only the materials that have been discussed in class.  Do not look for alternative methods that have not been covered as part of this course.

 

Program (100 points):

 

In this assignment, we are going to practice using linked lists.  To that effect, we will create and manipulate a linked list of employees to simulate a payroll application.  First, you will need to create an Employee class, according to the specifications below.

 

Specification for Employee class:

 

Attributes

  • Employee ID: a string – the ID will contain digits and/or hyphens.
  • Number of hours worked in a week: a double containing how many hours the employee has worked.
  • Hourly pay rate: a double that represents how much the employee is paid for one hour or work.
  • Gross wages: a double that stores the number of hours times the hourly rate.

 

Methods

  • default constructor: initializes attributes to blank or zeroes.
  • alternate constructor: receives and sets an employee ID.
  • set methods for each attribute (accessors).
  • get methods for each attribute (mutators).
  • a printEmployee: that displays all the information of a given employee.

 

Driver File

 

When the program starts, it should ask the user to enter each of the employees’ IDs. There should be no limit on the number of IDs the user can enter. The program then should display each employee identification number and ask the user to enter that employee’s hours and pay rate. The program should calculate the gross wages for that employee (hours times pay rate).  The data for all employees is stored in a linked lists of Employee nodes.

 

After the wages have been calculated for all the employees, the program should display each employee’s identification number, hours worked, hourly rate, and gross wages.

 

Make sure your program validates the data input: do not accept negative numbers for hours worked or numbers less than 6.00 for pay rate.

 

Here are a couple of sample runs of a typical solution to this problem:

 

 

Note:  Please make sure to submit well-written programs for these programming tasks. Good identifier names, useful comments, indentation, and spacing will be some of the criteria that will be used when grading this assignment.