Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Employee Details Java Program My professor gave me the criteria for this code. I am struggling to figure out how to print the Scanner console

Employee Details Java Program

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

My professor gave me the criteria for this code. I am struggling to figure out how to print the Scanner console input, which is provided by the website (not the user). I have tried using arrays, objects, but all that prints are the lines written in the ShowEmployee() method. I can't figure out how to get the information in getEmployee() method into the ShowEmployee() method. Someone please help me. I am so close.

Employee Details Define a class named Employee with following characteristics: Data members int employeeld String employeeName String designation int salary Methods void getEmployee() - Accepts console input for employeeld, employeeName, designation, and salary. void showGrade - Displays grade of an employee based on criteria specified below. Void ShowEmployee() - Displays employee details. Grade Salary 0 to 20000 20001 to 50000 50001 to 100000 100001 and above Input Codezinger Software Developer 800000 where, First line represents employee ID. Second line represents employee's name. Third line represents employee's designation. Fourth line represents employee's salary. Output Employee grade is: A Grade Employee details are: Employee ID=1 Employee Name=Codezinger Designation=Software Developer Salary=800000 where, Display grade with " Grade" appended to it. Employee details are separated by a new line. No new line should be present after salary. + Test Case(s) 1 - import java.util.*; 3. public class Employee { private int employeeID; private String employeeName; private String designation; private int salary; private int counter = 0; Employee[] array = new Employee 101; public void getEmployee(int employeeID, String employeeName, String designation, int salary). { I/accepts console input for employeeID, employeeName, designation, and Salary this.employeeID = employeeID; this.employeeName = employeeName; this.designation = designation; this.salary = salary; Scanner console = new Scanner(System.in); this.employeeID = console.nextInt(); this.employeeName = console.nextLine: this.designation = console.nextLine(); this.salary = console.nextInt(); array[counter] = new Employee(); array[counter).employeeID = this.employeeID; array(counter].employeeName = this.employeeName; array(counter].designation = this.designation; array[counter].salary = this.salary; counter++; public Employee[] getDetails(){ return array; public void showGrade() { //displays grade of an employee based on criteria specified char grade =0; if (salary >= 0 || salary = 20001 || salary = 50001 || salary = 100001) { grade = 'A'; System.out.println("Employee grade is: "); System.out.println(grade + " Grade "); public void ShowEmployee() { //displays employee details System.out.println("Employee grade is: "); System.out.println(grade + " Grade "); public void ShowEmployee() { //displays employee details showGrade(); System.out.println("Employee details are: "); System.out.println("Employee ID=" + employeeID); System.out.println(" Employee Name=" + employeeName); System.out.println(" Designation=" + designation); System.out.println(" Salary:" + salary); public void main(String[] args) { Scanner console = new Scanner(System.in); Employee myObject = new Employee(); int cnt = 0; for( int i =0; i = 0 || salary = 20001 || salary = 50001 || salary = 100001) { grade = 'A'; System.out.println("Employee grade is: "); System.out.println(grade + " Grade "); public void ShowEmployee() { //displays employee details System.out.println("Employee grade is: "); System.out.println(grade + " Grade "); public void ShowEmployee() { //displays employee details showGrade(); System.out.println("Employee details are: "); System.out.println("Employee ID=" + employeeID); System.out.println(" Employee Name=" + employeeName); System.out.println(" Designation=" + designation); System.out.println(" Salary:" + salary); public void main(String[] args) { Scanner console = new Scanner(System.in); Employee myObject = new Employee(); int cnt = 0; for( int i =0; i

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_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

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

Get Started

Recommended Textbook for

Oracle Database 10g Insider Solutions

Authors: Arun R. Kumar, John Kanagaraj, Richard Stroupe

1st Edition

0672327910, 978-0672327919

More Books

Students also viewed these Databases questions

Question

10. Will preventive maintenance eliminate all breakdowns?

Answered: 1 week ago