In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-10 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
Today, I would like to share with you the relevant knowledge of how to write the code of the java personnel information management system. The content is detailed and the logic is clear. I believe most people still know too much about this knowledge, so share this article for your reference. I hope you can get something after reading this article. Let's take a look at it.
To achieve additions, deletions, changes and searches.
The practice of getting started with java on Mini Program
1.Person class
Package p1; public class Person {/ / Person attributes private int num; private String name; private String sex; private int salary; public Person (int num, String name, String sex, int salary) {super (); this.num = num; this.name = name; this.sex = sex; this.salary = salary } / / A pair of Perosn operation methods public int getNum () {return num;} public void setNum (int num) {this.num = num;} public String getName () {return name;} public void setName (String name) {this.name = name;} public String getSex () {return sex } public void setSex (String sex) {this.sex = sex;} public int getSalary () {return salary;} public void setSalary (int salary) {this.salary = salary;}}
2.SysMenu class
Package p1; public class SysMenu {public static final String [] MENU = {"1. Employee Information Management, 2. Exit "}; public static final String [] OPERATION_MENU = {" 1. Add "," 2. Check "," 3. Modify "," 4. Delete "," 5. Return "}; public static void showMenu (String [] Menu) {for (int I = 0; I < Menu.length; iTunes +) System.out.print (Menu [I] +"\ t\ t "); System.out.println (); System.out.println ("-") }}
3.SysInfo class
Package p1; import java.util.ArrayList;import java.util.List; public class SysInfo {private static List informationList = new ArrayList (); / / get informationList public static List getList () {return informationList;}}
4.InformationService class
Package p1; import java.util.List; public class InformationService {private List informationList = SysInfo.getList (); / / get information list public List getList () {return informationList;} / / find information by number public Person getPersonByNum (final int num) {if (num < 1) {System.out.println ("numbering error"); return null } for (int I = 0; I < informationList.size (); iTunes +) {Person p = (Person) informationList.get (I); if (p.getNum () = = num) {System.out.println ("find success"); return p;}} System.out.println ("find failed") Return null;} / / View a single Person message public void showAPerson (Person p) {System.out.println ("No.\ t\ t name\ t\ t gender\ t\ t salary"); System.out.println (p.getNum () + "\ t\ t" + p.getName () + "\ t\ t" + p.getSex () + "\ t\ t" + p.getSalary ()) } / / show all Person public void showPerson () {System.out.println ("No.\ t\ t name\ t\ t gender\ t\ t salary"); List ps = getList (); for (int I = 0; I < ps.size (); iTunes +) {Person p = (Person) ps.get (I) System.out.println (p.getNum () + "\ t\ t" + p.getName () + "\ t\ t" + p.getSex () + "\ t\ t" + p.getSalary ());}} / / find information by name public Person getPersonByName (final String name) {if (name = = null) return null; for (int I = 0; I < informationList.size () Return null; +) {Person p = (Person) informationList.get (I); if (p.getName (). Equals (name)) {return p;}} return null;} / / check whether the object exists public boolean CheckExitByNum (int num) {for (int iTuno)
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.