In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly shows you "Java how to use sets to achieve a customer information management system", the content is easy to understand, clear, hope to help you solve your doubts, the following let the editor lead you to study and learn "Java how to use collections to achieve a customer information management system" this article.
1 customer class public class Customers {private String cid; private String name; private String sex; private String age; private String call; private String email; public Customers () {} public Customers (String cid,String name, String sex, String age, String call, String email) {this.cid=cid; this.name = name; this.sex = sex; this.age = age; this.call = call This.email = email;} 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 String getAge () {return age } public void setAge (String age) {this.age = age;} public String getCall () {return call;} public void setCall (String call) {this.call = call;} public String getEmail () {return email;} public void setEmail (String email) {this.email = email;} public String getCid () {return cid } public void setCid (String cid) {this.cid = cid;}} 2 main interface public class Customermanager {public static void main (String [] args) {ArrayList array = new ArrayList (); while (true) {System.out.println ("- customer information management software -"); System.out.println ("1 add customer") System.out.println ("2 modify customers"); System.out.println ("3 delete customers"); System.out.println ("4 customers list"); System.out.println ("5 exit"); System.out.println ("Please select 1-5"); Scanner sc = new Scanner (System.in) String line = sc.nextLine (); switch (line) {case "1": / / System.out.println ("1 add customer"); addCustomer (array); break Case "2": / / System.out.println ("2 modify customer"); modifyCustomer (array); break; case "3": / / System.out.println ("3 Delete customer"); deleteCustomer (array) Break; case "4": / / System.out.println ("4 View all customers"); findCustomer (array); break; case "5": System.out.print ("confirm whether you want to exit (Y hand N):") String y = sc.nextLine (); if (y.equals ("Y")) {System.exit (0);}} 3 method (1) add customer public static void addCustomer (ArrayList array) {Scanner sc = new Scanner (System.in) String cid; while (true) {System.out.println ("Please enter customer number"); cid = sc.nextLine (); boolean flag = isUsed (array,cid); if (flag) {System.out.println ("number is occupied, please re-enter");} else {break }} System.out.println ("Please enter customer name"); String name = sc.nextLine (); System.out.println ("Please enter customer gender"); String sex = sc.nextLine (); System.out.println ("Please enter customer age"); String age = sc.nextLine () System.out.println ("Please enter customer phone number"); String call = sc.nextLine (); System.out.println ("Please enter customer email"); String email = sc.nextLine (); Customers c = new Customers (); c.setCid (cid); c.setName (name); c.setSex (sex); c.setAge (age) C.setCall (call); c.setEmail (email); array.add (c); System.out.println ("added successfully");} (2) determine whether the number is occupied public static boolean isUsed (ArrayListarray, String cid) {boolean flag = false; for (int I = 0; 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.