question archive String firstName = ""; int birthYear; int type; int salary; int bonus; int rate; int hoursWorked; int earnings; ArrayList arrNames = new ArrayList(); ArrayList arrBirthYears = new ArrayList(); ArrayList arrSalOrHours = new ArrayList(); ArrayList arrBonusOrRate = new ArrayList(); ArrayList arrTypes = new ArrayList(); Scanner kbd = new Scanner (System

String firstName = ""; int birthYear; int type; int salary; int bonus; int rate; int hoursWorked; int earnings; ArrayList arrNames = new ArrayList(); ArrayList arrBirthYears = new ArrayList(); ArrayList arrSalOrHours = new ArrayList(); ArrayList arrBonusOrRate = new ArrayList(); ArrayList arrTypes = new ArrayList(); Scanner kbd = new Scanner (System

Subject:Computer SciencePrice:0 Bought3

String firstName = ""; int birthYear; int type; int salary; int bonus; int rate; int hoursWorked; int earnings; ArrayList arrNames = new ArrayList(); ArrayList arrBirthYears = new ArrayList(); ArrayList arrSalOrHours = new ArrayList(); ArrayList arrBonusOrRate = new ArrayList(); ArrayList arrTypes = new ArrayList(); Scanner kbd = new Scanner (System.in); // creating variables and read from the keyboard System.out.println("Enter your First Name: "); firstName = kbd.next(); // ******* Loop to input names and birth years and store them in an arraylist for (; !firstName.equals("9999");) { // if you get to this point it means that firstname is not 9999 arrNames.add(firstName); System.out.println("Enter your year of birth: "); birthYear = kbd.nextInt(); arrBirthYears.add(birthYear); System.out.println("Press 1 for FT , Press 2 for PT: "); type = kbd.nextInt(); arrTypes.add(type); if (type == 1) { // employee is a FT System.out.println("Enter Salary: "); salary = kbd.nextInt(); arrSalOrHours.add(salary); System.out.println("Enter Bonus: "); bonus = kbd.nextInt(); arrBonusOrRate.add(bonus); } else if (type == 2) { // employee us a PT System.out.println("Enter Hours Worked: "); hoursWorked = kbd.nextInt(); arrSalOrHours.add(hoursWorked); System.out.println("Enter rate: "); rate = kbd.nextInt(); arrBonusOrRate.add(rate); } else { // if none of the above System.out.println("Invalid Employee Type"); } System.out.println("Enter your First Name: "); firstName = kbd.next(); } // end of for // ******* Loop to read names and birth years from the arraylist for (int i=0; i < arrNames.size() ;i++) { System.out.println("Hello " + arrNames.get(i)); System.out.println("You were born in " + arrBirthYears.get(i)); int age; age = 2023 - arrBirthYears.get(i); System.out.println("you are " + age + " years old"); if (arrTypes.get(i) == 1) { // full time System.out.println("Type of employement: FULL TIME"); System.out.println("Salary: " + arrSalOrHours.get(i)); System.out.println("Bonus: " + arrBonusOrRate.get(i)); earnings = arrSalOrHours.get(i) + arrBonusOrRate.get(i); System.out.println("Total Earnings: " + earnings); } if (arrTypes.get(i) == 2) { // part time System.out.println("Type of employement: PART TIME"); System.out.println("Hours Worked: " + arrSalOrHours.get(i)); System.out.println("Rate: " + arrBonusOrRate.get(i)); earnings = arrSalOrHours.get(i) * arrBonusOrRate.get(i); System.out.println("Total Earnings: " + earnings); } System.out.println("-----------------"); } System.out.println("The end"); Same as In_Class_Developed_Parallel_Arrays however create 4 parallel arrays (arrSal, arrBonus, arrrate, arrHours

pur-new-sol

Purchase A New Answer

Custom new solution created by our subject matter experts

GET A QUOTE
Files:

Related Questions