Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use Java Vector to realize Class Information Management system

2025-01-16 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 "how to use Java Vector to realize the class information management system". The editor shows you the operation process through the actual case, the operation method is simple and fast, and the practicality is strong. I hope this article "how to use Java Vector to realize the class information management system" can help you solve the problem.

The code is as follows:

Import java.util.*;public class Demo3 {public static void main (String [] args) {Manage2 M = new Manage2 (); Scanner reader = new Scanner (System.in); while (true) {System.out.println ("0. Load original information "); System.out.println (" 1. Add student information "); System.out.println (" 2. Check the student information according to the student number "); System.out.println (" 3. Revise students' comprehensive evaluation scores); System.out.println ("4. Delete student information "); System.out.println (" 5. According to the comprehensive evaluation ranking "); System.out.println (" 6. Print information about all students "); System.out.println (" 7. Exit the system "); System.out.print (" Please enter the function of your choice [0x7]: "); int x; x = reader.nextInt (); switch (x) {case 0: Student f = new Student (" 2018 "," Bruce Lee ", 23," male ", 98.56) Student g = new Student ("2019", "fish young Wei", 31, 'female', 77.42); Student h = new Student ("2020", "seasonal long wind", 17, 'male', 85.56); Student o = new Student ("2021", "Xuanyuan Chen", 12, 'male', 56.42) Student p = new Student ("2022", "Xu Fengnian", 25, 'male', 95.01); M.addStudent (f); M.addStudent (g); M.addStudent (h); M.addStudent (o); M.addStudent (p) System.out.println ("Information loaded successfully!") ; break; case 1: String id; String name; int age; char sex; double result; System.out.println ("Please enter the student ID, age and gender comprehensive evaluation results (separated by a space):") Id = reader.next (); / / System.out.println ("Please enter student name:"); name = reader.next (); / / System.out.println ("Please enter student age:"); age = reader.nextInt (); / / System.out.println ("Please enter student gender:") Sex = reader.next (). CharAt (0); / / System.out.println ("Please enter students' comprehensive evaluation scores:"); result = reader.nextDouble (); Student e = new Student (id, name, age, sex, result); M.addStudent (e) System.out.println ("student information added successfully!") ; break; case 2: System.out.println ("enter the student number you want to query:"); String idd = reader.next (); M.findinfo (idd); break; case 3: System.out.println ("enter the student number you want to change:") String iddd = reader.next (); System.out.println ("enter the comprehensive evaluation of the purpose you want to change:"); double resultt = reader.nextDouble (); M.change (iddd, resultt); break; case 4: System.out.println ("enter the student number you want to delete:") String idddd = reader.next (); M.deleteStu (idddd); break; case 5: M.sort (); System.out.println ("sort successfully!") ; M.PrintInfo (); break; case 6: M.PrintInfo (); break; case 7: System.out.println ("the program is finished, see you next time!") ; System.exit (0); break; case 8: System.out.println ("number between 1 and 7!") ; break;} / / manage student class class Manage2 {l=new Vector (); public Manage2 () {l=new Vector ();} / / add student information public void addStudent (Student e) {l.add (e) } / / check the student information according to the student number public void findinfo (String id) {for (int item0)

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.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report