Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I\'m in java one and I need help with this code. please follow the directions (

ID: 3678708 • Letter: I

Question

I'm in java one and I need help with this code. please follow the directions (use arrays and for loops). make sure that the output matches the given outpu. I will apreciate you help. thank you.

Programming Concepts

1. Arrays
2. forLoops

Assignment Description

You will be simulating a payroll manager, where you must calculate paychecks for three people.

You must accomplish this assignment using two arrays: one array to hold the employee IDs, and another to hold the paycheck amounts.

For example:

The two arrays will be parallel arrays, so employee 12345's paycheck will be $250.46, employee 98765's paycheck will be $512.65, and employee 13579's paycheck will be $888.46.

Assignment Requirements

You must use an array to hold the ID numbers, and another one to hold the paycheck amounts

You must print out the dollar amount with commas, if necessary. To do that, use the format specifier %,.2f

Assignment Suggestions

1. Declare these variables:

a. int[] ID:   An array to hold the employee ID numbers (size 3)

b. double[] paychecks:   An array to hold the paycheck amounts (size 3)

c. double wage:   To store the employee's wage
d. int hours: To store the employee's hours worked

2.Prompt the user to enter in the employee IDs, separated by spaces.

3.Store each ID number entered into the array of IDs.

4.Using a loop...

a. Ask the user to enter in the employee's wage

i. Store the wage

b. Ask the user to enter in the employee's hours

i. Store the hours

c. Calculate their paycheck, and store the result into the paycheck array for the employee. 5. Using a loop...

5. using a loop

a. Print out each employee's name and their wage, like in the sample output.

output example

user@loki:~$ java PayrollManager
Please enter three employee IDs, separated by spaces: 24680 56789 44444

What is employee 24680's hourly wage? $2.34
How many hours did employee 24680 work this week? 25

What is employee 56789's hourly wage? $0.01
How many hours did employee 56789 work this week? 168

What is employee 44444's hourly wage? $593.32
How many hours did employee 44444 work this week? 832

Employee 24680 will be paid $58.50 this week. Employee 56789 will be paid $1.68 this week. Employee 44444 will be paid $493,642.24 this week.

Run 2

user@loki:~$ java PayrollManager

Please enter three employee IDs, separated by spaces: 31415 11235 27182

What is employee 31415's hourly wage? $0.93
How many hours did employee 31415 work this week? 50000

What is employee 11235's hourly wage? $54321 How many hours did employee 11235 work this week? 2

What is employee 27182's hourly wage? $3.65 How many hours did employee 27182 work this week? 25

Employee 31415 will be paid $46,500.00 this week.

Employee 11235 will be paid $108,642.00 this week.

Employee 27182 will be paid $91.25 this week.

2 ID 12345 98765 13579

Explanation / Answer

package practice;
import java.util.Scanner;

/**
*
* @author Shivakumar
*/
public class PayrollManager { // input calculation class
static int[] ID=new int[3];
static double[] paychecks= new double[3]; // declaring required variables
static double wage;
static int hours;
public void wages(int hours,double hwage,int index) // method for pay chekcs calculation
{
  
switch(index)
{
case 0: paychecks[0]=hours*hwage;
  
case 1: paychecks[1]=hours*hwage;
  
case 2: paychecks[2]=hours*hwage;
}
}
public void input() // method for input data ID
{
Scanner sc=new Scanner(System.in);
System.out.println("Please enter three employee IDs, separated by spaces:");
String[] temp=sc.nextLine().split("\s+"); // Storing IDs in a String array
ID[0]=Integer.parseInt(temp[0]); // Converting String to int
ID[1]=Integer.parseInt(temp[1]);
ID[2]=Integer.parseInt(temp[2]);

}

public static void main(String[] args)
{


PayrollManager obj=new PayrollManager(); // creating object
obj.input(); //calling input
Scanner sc1=new Scanner(System.in); // Scanner for input
for(int i=0;i<3;i++) // loop for input and output
{
System.out.println("What is employee "+ID[i]+"'s hourly wage?$");
  PayrollManager.wage=sc1.nextDouble();
System.out.println("How many hours did employee "+ID[i]+" work this week?");
  PayrollManager.hours=sc1.nextInt();
obj.wages( PayrollManager.hours, PayrollManager.wage, i);


}
for(int i=0;i<3;i++) // loop for result
System.out.print("Employee "+ID[i]+" will be paid "+ PayrollManager.paychecks[i]+" this week. ");

  
}

  
  
  
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote