Design a java program that uses the following four parallel arrays: empId, an ar
ID: 3553307 • Letter: D
Question
Design a java program that uses the following four parallel arrays: empId, an array of seven integers to hold employee id numbers. The array should be initialized with { 56588, 45201, 78951, 87775, 84512, 13028, 75804 }, hours, an array of seven integers to holdthe number of hours worked by each employee, payRate, an array of seven doubles to hold each employee's hourly pay rate, and wages, an array of seven doubles to hold each employee's gross wages. The program should display each employee number and ask the user to enter that employee's hours and pay rate. It should then calculate the gross wages for that employee (hours times pay rate), which should be stored in the wages array. After the data has been entered for all the employees, the program should display each employee's id number and gross wages.
I've tried several of the answers given to previous questioners, but had problems compiling them even after attempting to working thru the error messages given by JGrasp.
Explanation / Answer
Declare Integer empID(6)
empID(0) = 56588
empID(1) = 45201
empID(2) = 78951
empID(3) = 87775
empID(4) = 84512
empID(5) = 13028
empID(6) = 75804
Declare Integer hours(6)
Declare Decimal payRate(6)
Declare Decimal wages(6)
For x = 0 To 6
Display "Enter hours worked for employee: " & empID(x)
Input hours(x)
Display "Enter pay rate for employee: " & empID(x)
Input payRate(x)
wages(x) = hours(x) * payRate(x)
Next
For x = 0 To 6
Display "Employee number: " & empID(x) & " wages are $" & wages(x)
Next
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.