In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly explains "how to use Java to achieve a simple employee management system", the content of the article is simple and clear, easy to learn and understand, the following please follow the editor's ideas slowly in depth, together to study and learn "how to use Java to achieve a simple employee management system"!
The code is as follows:
Import java.util.*;public class Demo {public static void main (String [] args) {EmpManage em = new EmpManage (); while (true) {System.out.println ("= employee management system ="); System.out.println ("= 0. Load original information = "); System.out.println (" = 1. Join the employee = "); System.out.println (" = 2. Delete employee = "); System.out.println (" = 3. Query employee information = "); System.out.println (" = 4. Modify employee salary = "); System.out.println (" = 5. Salary order = = "); System.out.println (" = 6. Average wage, minimum and maximum wage = "); System.out.println (" = 7. Print all employee information = "); System.out.println (" = 8. Exit the system = "); System.out.print (" Please select function [0x8]: "); Scanner reader = new Scanner (System.in); int x; x = reader.nextInt (); switch (x) {case 0: Employee E1 = new Employee (" 2001 "," Xuanyuan GE ", 2002f) Employee f = new Employee ("2002", "seasonal long wind", 4500f); Employee g = new Employee ("2003", "young fish", 2560f); Employee h = new Employee ("2004", "Bruce Lee", 1604f); em.addEmp (E1); em.addEmp (f); em.addEmp (g) Em.addEmp (h); System.out.println ("loaded!") ; break; case 1: System.out.println ("Please enter information about the employee to be added (number, name, salary separated by a space)"; String a, b; float c; a = reader.next (); b = reader.next () C = reader.nextFloat (); Employee e = new Employee (a, b, c); em.addEmp (e); System.out.println ("join successfully!") ; break; case 2: System.out.print ("Please enter the number of the employee to be deleted:"); String y; y=reader.next (); em.deleteEmp (y); System.out.println ("deleted successfully!") ; break; case 3: System.out.print ("Please enter the number of staff to be queried:"); String z; z=reader.next (); em.showinfo (z); break Case 4: System.out.print ("Please enter the number of staff to be modified:"); String w; w=reader.next (); System.out.print ("Please enter the number of wages to be modified:"); float v; v=reader.nextFloat () Em.changesal (w, v); System.out.println ("modified successfully!") ; break; case 5: System.out.println ("1. Sort by salary order from highest to lowest "); System.out.println (" 2. Sort by salary from low to high "); System.out.print (" Please select the function [1: 2]: "); int t; t=reader.nextInt (); if (tweeted 1) {em.sorthl () } if (tweezers 2) {em.sortlh ();} break; case 6: em.hlsal (); break; case 7: em.showAll (); break Case 8: System.out.println ("the program is finished, see you next time!") ; System.exit (0); break; default: System.out.print ("numbers can only range from 1 to 8!") ;} / / employee management class class EmpManage {private ArrayList al=null; / / Constructor public EmpManage () {al=new ArrayList ();} / join employee method public void addEmp (Employee e) {al.add (e);} / delete employee public void deleteEmp (String x) {int i; for (item0) I
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.