Answered step by step
Verified Expert Solution
Question
1 Approved Answer
plz I need the solution in very basic methods no arraylist or sorting functions are allowed to approach! The code should be in just one
plz I need the solution in very basic methods
no arraylist or sorting functions are allowed to approach!
The code should be in just one file named Database!
Thanks
The result should be like: Employee Management System 1. Add Employee. 2. Remove Employee. 3. Print Alphabetically. 4. Print By ID Number. 5. Issue Pay Increase. 6. Get Payroll Cost. 7. Quit. Please enter your choice > 1 Name? > Sally Salary? > 87432 1. Add Employee. 2. Remove Employee. 3. Print Alphabetically. 4. Print By ID Number. 5. Issue Pay Increase. 6. Get Payroll Cost. 7. Quit. Please enter your choice > 3 Sally, 1, 87432.0 1. Add Employee. 2. Remove Employee. 3. Print Alphabetically. 4. Print By ID Number. 5. Issue Pay Increase. 6. Get Payroll Cost. 7. Quit. Please enter your choice > 1 Name? > Adam Salary? > 32986.43 1. Add Employee. 2. Remove Employee. 3. Print Alphabetically. 4. Print By ID Number. 5. Issue Pay Increase. 6. Get Payroll Cost. 7. Quit. Please enter your choice > 3 Adam, 2, 32986.43 Sally, 1, 87432.0 1. Add Employee. 2. Remove Employee. 3. Print Alphabetically. 4. Print By ID Number. 5. Issue Pay Increase. 6. Get Payroll Cost. 7. Quit. Please enter your choice > 1 Name? > Joe Salary? > 68536 1. Add Employee. 2. Remove Employee. 3. Print Alphabetically. 4. Print By ID Number. 5. Issue Pay Increase. 6. Get Payroll Cost. 7. Quit. Please enter your choice > 3 Adam, 2, 32986.43 Joe, 3, 68536.0 Sally, 1, 87432.0 1. Add Employee. 2. Remove Employee. 3. Print Alphabetically. 4. Print By ID Number. 5. Issue Pay Increase. 6. Get Payroll Cost. 7. Quit. Please enter your choice > 1 Name? > Katie Salary? > 65738 1. Add Employee. 2. Remove Employee. 3. Print Alphabetically. 4. Print By ID Number. 5. Issue Pay Increase. 6. Get Payroll Cost. 7. Quit. Please enter your choice > 3 Adam, 2, 32986.43 Joe, 3, 68536.0 Katie, 4, 65738.0 Sally, 1, 87432.0 1. Add Employee. 2. Remove Employee. 3. Print Alphabetically. 4. Print By ID Number. 5. Issue Pay Increase. 6. Get Payroll Cost. 7. Quit. Please enter your choice > 1 Name? > Todd Salary? > 63822 1. Add Employee. 2. Remove Employee. 3. Print Alphabetically. 4. Print By ID Number. 5. Issue Pay Increase. 6. Get Payroll Cost. 7. Quit. Please enter your choice > 3 Adam, 2, 32986.43 Joe, 3, 68536.0 Katie, 4, 65738.0 Sally, 1, 87432.0 Todd, 5, 63822.0 1. Add Employee. 2. Remove Employee. 3. Print Alphabetically. 4. Print By ID Number. 5. Issue Pay Increase. 6. Get Payroll Cost. 7. Quit. Please enter your choice > 4 Sally, 1, 87432.0 Adam, 2, 32986.43 Joe, 3, 68536.0 Katie, 4, 65738.0 Todd, 5, 63822.0 1. Add Employee. 2. Remove Employee. 3. Print Alphabetically. 4. Print By ID Number. 5. Issue Pay Increase. 6. Get Payroll Cost. 7. Quit. Please enter your choice > 2 ID Number? > 3 1. Add Employee. 2. Remove Employee. 3. Print Alphabetically. 4. Print By ID Number. 5. Issue Pay Increase. 6. Get Payroll Cost. 7. Quit. Please enter your choice > 4 Sally, 1, 87432.0 Adam, 2, 32986.43 Katie, 4, 65738.0 Todd, 5, 63822.0 1. Add Employee. 2. Remove Employee. 3. Print Alphabetically. 4. Print By ID Number. 5. Issue Pay Increase. 6. Get Payroll Cost. 7. Quit. Please enter your choice > 3 Adam, 2, 32986.43 Katie, 4, 65738.0 Sally, 1, 87432.0 Todd, 5, 63822.0 1. Add Employee. 2. Remove Employee. 3. Print Alphabetically. 4. Print By ID Number. 5. Issue Pay Increase. 6. Get Payroll Cost. 7. Quit. Please enter your choice > 2 ID Number? > 3 Employee 3 does not exist. 1. Add Employee. 2. Remove Employee. 3. Print Alphabetically. 4. Print By ID Number. 5. Issue Pay Increase. 6. Get Payroll Cost. 7. Quit. Please enter your choice > 3 Adam, 2, 32986.43 Katie, 4, 65738.0 Sally, 1, 87432.0 Todd, 5, 63822.0 1. Add Employee. 2. Remove Employee. 3. Print Alphabetically. 4. Print By ID Number. 5. Issue Pay Increase. 6. Get Payroll Cost. 7. Quit. Please enter your choice > 5 Percent Increase (e.g. .02)? > .1 1. Add Employee. 2. Remove Employee. 3. Print Alphabetically. 4. Print By ID Number. 5. Issue Pay Increase. 6. Get Payroll Cost. 7. Quit. Please enter your choice > 3 Adam, 2, 36285.073000000004 Katie, 4, 72311.8 Sally, 1, 96175.20000000001 Todd, 5, 70204.20000000001 1. Add Employee. 2. Remove Employee. 3. Print Alphabetically. 4. Print By ID Number. 5. Issue Pay Increase. 6. Get Payroll Cost. 7. Quit. Please enter your choice > 6 274976.27300000004 1. Add Employee. 2. Remove Employee. 3. Print Alphabetically. 4. Print By ID Number. 5. Issue Pay Increase. 6. Get Payroll Cost. 7. Quit. Please enter your choice > 7
The file that could be used as Driver /** * Write a description of class Driver here. * * @author (your name) * @version (a version number or a date) */ import java.util.Scanner; public class Driver { public static void main (String[] args) { Scanner in = new Scanner(System.in); Database db = new Database(); int choice = 0; System.out.println("Employee Management System"); while (choice != 7) { //menu options System.out.println("1. Add Employee."); System.out.println("2. Remove Employee."); System.out.println("3. Print Alphabetically."); System.out.println("4. Print By ID Number."); System.out.println("5. Issue Pay Increase."); System.out.println("6. Get Payroll Cost."); System.out.println("7. Quit."); System.out.print(" Please enter your choice > "); choice = in.nextInt(); in.nextLine(); switch (choice) { case 1: System.out.print(" Name? > "); String name = in.nextLine(); System.out.print(" Salary? > "); double salary = in.nextDouble(); in.nextLine(); db.addEmployee(name, salary); break; case 2: System.out.print(" ID Number? > "); int id = in.nextInt(); in.nextLine(); db.removeEmployee(id); break; case 3: db.printAlphabetically(); break; case 4: db.printById(); break; case 5: System.out.print(" Percent Increase (e.g. .02)? > "); double percent = in.nextDouble(); in.nextLine(); db.payIncrease(percent); break; case 6: System.out.println(db.getPayrollCost()); break; case 7: break; default: System.out.println("That is an invalid choice. Please try again. "); } System.out.println(); } } }Problem Statement You are going to build a database that an employer can use to keep track of their employees. You will need a way to represent a single employee (name, id number, salary) and a way to store an unknown number of employees. You will build the capability to add remove employees from the database and provide some other functionality described below. Assignment Create an outlab5 project and paste this into a Driver. You won't need to change the Driver Here are descriptions of the methods you need o addEmployee. This method reads in name and salary to represent a new employee. The employee id number is just the number that employee was to join the company. I e. The first employee added has id number 1, the second id number 2 and so on. If an employee ends up leaving the company, employee numbers stay the same and new employees are still given the next number. E.g. If employee 1 leaves employee 2 stays employee 2 o remove Employee. This method removes an employee from the database based on the employee id number passed. I e. If employee 123 is to be removed, find the employee with id number 123 and remove them. If that employee does not exist, print an error message. o print Alphabetically. This method will print out all the employees in the database in alphabetical order. o printByld. This method will print out all the employees in the database by order of their id numbers starting with employee 1. If some employee (e.g. employee number 7) is no longer in the database, just skip that number. o pay Increase. Give each employee a pay increase of X% where X is the input parameter o getPayroll Cost. Return the total amount of salary of all the employees in the database Here is some sample output
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