Ass 1
Ass 1
Ass 1
1.Add employee
2.Delete employee
3.Raise salary
4.List all
5.Exit
----------------------
Enter your choice:
The Add option – If the user inputs 1, the program prompts for the name, salary , and hire day
of the employee. An object is then created and added to the array. Two employees are considered
equal if they have the same name and the same hire day. The company cannot have two
employees that are equal.
The Delete option- If the user enters 2, the program prompts for the name and hire day of the
employee, searches for it and if it finds it, deletes the employee from the array and then outputs
a message saying that the record for the employee has been deleted. If the employee is not
found, an appropriate message is displayed.
The Raise Salary option - If the user chooses option 3, he/she is prompted for the name of the
employee. All employees with the input name are displayed in a numbered list as such:
1. John Doe, 03/01/2020
2. John Doe, 01/01/1800
3. John Doe, 02/10/ 1998
The user is then prompted for the number of the employee, i. When this information is input, the
user is prompted for the percentage of the increase to apply to the salary of the ith employee in
the list and the salary is updated accordingly. For example, if the user inputs 1 for i and then 3 for
the raise, the salary of the first John Doe on the list is increased by 3%.
The List All option - If the user enters 4, the information of all the employees is displayed, one
employee per line.
Any choice from the menu other than 1,2, 3, 4 or 5 displays a message informing the user of the
invalidity of the choice and prompts for it again.
There are two ways to end the program normally: either by having the user choose the Exit option
or when an invalid choice is entered more than 5 consecutive times.
Notes:
employee1.equals(employee2);
You may assume that the user will always enter the correct type of data (i.e. numbers for
salaries, strings for names, etc.).
Following the good coding practice guidelines we have seen in class.
Use casting only where necessary.
Cheating is a serious offense. If a student is found to have copied part or all of the
assignment, he or she will receive a zero on the assignment. During exams, if a student is
caught cheating, he or she will receive a zero on the exam. This might result in the
student getting an F on the course. NO EXCUSES WILL BE ACCEPTED. The same
applies to the person providing others with material. The same applies to plagiarism
(presenting someone else’s work as being one’s own work).
Deadline policy