Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write the application class and define: a method that finds and returns the employee who earns the lowest salary, a method that prints all employees
Write the application class and define:
- a method that finds and returns the employee who earns the lowest salary,
- a method that prints all employees in the array
- a method that returns the average salary
- the main method that creates an array of Employee, then test a), b), c)
import java.util.Scanner; public class Employee public int id; public String name; public double salary; public void Input() { System.out.println("Enter name: "); name = new Scanner(System.in).nextLine(); System.out.println("Enter ID: "); id = Integer.parseInt(new Scanner(System.in).nextLine()); System.out.println("Enter Salary: "); salary - Double.parseDouble(new Scanner(System.in).nextLine()); } public void Output() { System.out.printf("Name: $155, ID: %255, Grade: %3$s ", name, id, salary); 3 public String toString() { return String.format("Name: %15, ID: $2$, Grade: %3$s", name, id, salary); } }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started