In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces the relevant knowledge of java how to achieve the student dormitory system, the content is detailed and easy to understand, the operation is simple and fast, and has a certain reference value. I believe you will gain something after reading this java article on how to achieve the student dormitory system. Let's take a look at it.
Student class code
Student.java
Package dormitory;public class Student {private String id; private String name; private String sex; private String dormid; public String getId () {return id;} public void setId (String id) {this.id = id;} 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 getDormid () {return dormid;} public void setDormid (String dormid) {this.dormid = dormid;}}
Main operation code
IntailStudent.java
Package dormitory;import java.awt.List;import java.io.BufferedReader;import java.io.BufferedWriter;import java.io.FileNotFoundException;import java.io.FileReader;import java.io.FileWriter;import java.io.IOException;import java.util.ArrayList;import java.util.Iterator;import java.util.Scanner;import javax.print.DocFlavor.INPUT_STREAM;import javax.swing.event.ListSelectionEvent;import org.omg.PortableInterceptor.IORInterceptor;public class InitailStudent {private static int naughty; private static Student [] stu=new Student [100] / / main function public static void main (String [] args) throws IOException {boolean a false; boolean bounded false; InitailStudent student=new InitailStudent (); student.judge (a, b);} / login function private void judge (boolean a, boolean b) throws IOException {do {System.out.println ("Welcome to the login page!") ; Scanner input=new Scanner (System.in); System.out.println ("Please enter account:"); String account=input.nextLine (); System.out.println ("Please enter password:"); String code=input.nextLine (); a=account.equals ("admin"); b=code.equals ("admin");} while (! (a==true&&b==true)) Menu ();} / / system menu page private void Menu () throws IOException {Scanner input=new Scanner (System.in); System.out.println ("- Welcome to the dormitory management system -"); System.out.println ("- Please select the following actions -") System.out.println ("--1. Show all student information-- "); / / Show () System.out.println ("-2. Query student information-"); / / Find () System.out.println ("-3. Add student information-"); / / Add () System.out.println ("-4. Modify student information-"); / / Renew () System.out.println ("-5. Delete student information-"); / / Delete () System.out.println ("-0. Exit the system-- "); System.out.println (" Please enter 1x5: "); int a=input.nextInt (); while (a5) {System.out.println (" incorrect input, please re-enter: "); a=input.nextInt () } switch (a) {case 1: Show (); break; case 2: Find (); break; case 3: Add (); break; case 4: Renew (); break; case 5: Delete () Break; case 0: System.out.println ("exit the system successfully!") ; System.exit (0); break;}} / / display all the information of the student private void Show () throws IOException {System.out.println ("the total information you enter is as follows:"); System.out.println ("* *") BufferedReader br=new BufferedReader (new FileReader ("student.txt")); String line; while ((line=br.readLine ())! = null) {System.out.println (line);} br.close (); System.out.println ("\ n\ r"); System.out.println ("the information entered this time is") System.out.println ("* *"); int i; for (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.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.