Java programming 5th edition chapter 9 Parallel Arrays Write a Java program to c
ID: 3793703 • Letter: J
Question
Java programming 5th edition chapter 9 Parallel Arrays
Write a Java program to create 4 parallel arrays - one to hold employee names, one to hold gross pays, one to hold deduction amounts, and one to hold net pays. Read the names into the array from the keyboard, read the gross pay data from a file, and assign the deduction amounts when you create the array. Use the data below.
Perform the following functions using the arrays, each in a separate method.
* Calculate the net pay array amounts by subtracting the deduction amount from the gross pay
* Write one method to calculate the sum of the values in any one array and call it 3 times, once to total the gross pay amounts, once to total the deduction amounts, and once to total the net pay amounts
*Determine the employee with the highest net pay.
* Determine the employee with the lowest net pay.
Print the arrays in column form with table headings and the totals below each column( See below for format). Print the name and net pay for the employees with the highest and lowest net pay. Do all output in main().
Name Gross Pay Deductions Net Pay
______________________________________________
John Brown $2000.00 $525.00 $1475.00
Jim Smith $3750.25 $1025.00 $2725.25
Sue Fuller $1115.50 $300.00 $815.50
Bob Allen $2348.50 $730.25 $1618.25
Leslie Brown $1800.00 $675.75 $1124.25
______________________________________________
Total $11014.25 $3256.00 $7758.25
The employee with the highest net pay is Jim Smith with $2725.25
The employee with the lowest net pay is Sue Fuller with $815.50
Explanation / Answer
I assume that you can input data in class
now the funtion for it are as follow
class abc
{
int i,j,n,max,min,p1,p2;
double gr[10],ded[10],netpay[10];
char n[5][10];
public :
void inpu()
{
}
// by you
void ouput1()
{
System.out.println(" Name Gross Pay Deductions Net Pay ");
min=netpay[0];
max=0;
for (i=1;i<=n;i++)
{
netpay[i]=gr[i]-ded[i];
if(netpay[i]>max)
{
max=netpay[i];
p=i;
}
if(netpa[i]<min)
{
min=netpay[i];
p1=[i]
}
System.out.println(" +n[i] +gr[i] ded[i] netpay[i] ");
}
System.out.println(" The employee with the highest net pay is " +n[p1] +max);
System.out.println(" The employee with the lowest net pay is " +n[p2] +min);
}
make a min funtion here
{
}
} end of class
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.