Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

import java.util.ArrayList; import java.util.Scanner; public class Salary { public String name; public Double hour; public Double rate; public Double calculate() { return hour * rate;

import java.util.ArrayList; import java.util.Scanner; public class Salary { public String name; public Double hour; public Double rate; public Double calculate() { return hour * rate; } } public class TestSalary { ArrayList employeeArray = new ArrayList(); public void main(String[] args) { Scanner in = new Scanner(System.in); public void sethighest(double max); return max; int i = 0; while (true) { Salary s = new Salary(); System.out.print("Enter the name of Employee or Q to exit: "); String n = in.nextLine(); if (n.equalsIgnoreCase("Q")) { return; } else if(n == "R") { // remove name System.out.print("Enter the name of Employee"); String removedEmployee = in.nextLine(); for (Salary sal : employeeArray ) { if(sal.name == removedEmployee) { employeeArray.remove(sal); System.out.print("Its removed !!"); } } } else { // Adding name s.name = n; System.out.print("Enter the number hours worked: "); s.hour = in.nextDouble(); System.out.print("Enter the pay rate per hour: "); s.rate = in.nextDouble(); employeeArray.add(s); } for (Salary salary : employeeArray) { System.out.println("name of Emp" + salary.name); System.out.println("Salary" + salary.calculate()); //System.out.println(name + "\t\t" + hour + "\t\t" + salary); } } } } can any one help fix the errors

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

Explain how employee engagement data is Big Data in HR.

Answered: 1 week ago

Question

Tell the merits and demerits of Mendeleev's periodic table.

Answered: 1 week ago

Question

4. What sales experience have you had?

Answered: 1 week ago