Question
Object Oriented Programming 14011102-4 (((in java)) i need it to be a simple code ________________________________________________ 1-Create a new class called Employee . This class should
Object Oriented Programming 14011102-4
(((in java)) i need it to be a simple code
________________________________________________
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
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
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