Question
This assignment is meant to be done in pseudocode. Must use a loop to capture each employee's input individually. The following is not allowed: input
This assignment is meant to be done in pseudocode.
Must use a loop to capture each employee's input individually.
The following is not allowed: input salary[], hoursWorked[], dept[]
The input line above assumes that the input is parallel arrays already organized. Understand the data is entered in the system by employee data and that the information must put in the correct parallel array and at the right index in each array. For example, assume the input for each employee is as follows: Last name, first name, dept #, hourly pay, and # of hours worked "Wright-Hamor", "Cimone", 4, 52, 40
The assignment will require the declaration of an array of unknown size, as shown below:
string employeeNames[]
7. a. Design the logic for a company application that breaks down payroll by the department. Input includes each employees last name, first name, department number, hourly salary, and the number of hours worked. The output is a list of the seven departments in the company (numbered 1 through 7) and the total gross payroll (rate times hours) for each department.
Example output should be as follows:
1: 5648
2: 51688
3: 546983
4: 893166
5: 234689
6: 194136
7: 46813549
7 b. Modify Exercise 7a so that the report lists department names as well as numbers. The department names are shown in Table 5-3. Example output should be as follows:
Personnel,1: 5648
Marketing, 2: 51688
Manufacturing, 3: 546983
Computer Services, 4: 893166
Sales, 5: 234689
Accounting, 6: 194136
Shipping, 7: 46813549
This is worth 15 points. Note: The final gross pay values will not be as shown above. Hint: use parallel arrays and a loop to complete both problems.
Table 5-3
Department Number | Department Name |
1 | Personnel |
2 | Marketing |
3 | Manufacturing |
4 | Computer Services |
5 | Sales |
6 | Accounting |
7 | Shipping |
Notes:
- Don't worry about saving the input yet. Add a loop to take employee input. Note that because the number of employees is unknown you must use a while-loop. (loop #1)
- Add parallel arrays to store employee information and a counter to track the number of employees. Please refer to the assignment to figure out how to create an array of an unknown size
- Use the employee counter as an index for the employee parallel arrays.
- The gross pay for dept can be an array of accumulators. In loop 1, calculate the gross pay and add it to the correct dept in the dept gross pay accumulator
- Create a new loop that prints an array of department numbers and gross pay using a loop (loop #2)
Assignment is already done but I would like to see how others do it to see if I can understand it better.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started