Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

*I need it the 1+2 to be in one code and in a simple way..* - - Complete the following tasks in java 1-Create a

*I need it the 1+2 to be in one code and in a simple way..*
-
-
Complete the following tasks in java
1-Create a new class called Employee.
This class should have the following data members:
The employee name (name) as a String.
The employee number (ID) as a long.
The employee salary (salary) as a double.
The class must also have 2 constructors and a printing method
The first constructor takes the employee ID and name as parameters and assign them to the data members ID and name
The second constructor takes the employee ID, name and salary as parameters and assign them to the data members ID, name and salary
o All the parameters must have the same names as the data members they will be assigned to and identified using this.
A method called print that will print all the employee information as follow:
122 Ahmed Abdullah 8000
Note: if the employees salary has not been assigned yet then -1 should be printed on its place:
122 Ahmed Abdullah -1
Then create a method called insertEemployee that return nothing and takes no argument. When this method is called it will ask the user to insert the information of a new employee (name, ID and salary) using the keyboard.
2-create a new class called Employees then create a main method in this class.
In the main method create an array of employees (from the type employee). Fill in the information of all the employees using the insert method before printing their information using a for loop and the print method.

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

Students also viewed these Databases questions

Question

6. Explain the strengths of a dialectical approach.

Answered: 1 week ago