java教學管理系統
『壹』 用java做個管理系統應該怎麼做
看一下JDBC相關的API。
然後就是把所有JAVA代碼嵌入到JSP中來寫,這樣是最省事的。
也可以使用servlet+JSP來寫,不過相對的就要多學一點知識。
不過這種只能算是初級一些的
現在流行SSH框架 ,你也可以學習進行應用。
恩最基本的代碼,你可以去借一些實例書,參考的做一個,這樣也比較速成。
既然你有java基礎看懂一些也不是很困難,邊做邊學邊思考你上手不會很難
『貳』 Java:做一個學生管理系統要做些什麼啊
下面是我前不久做的一個系統,你可以參考一下:
課程管理系統確認項目系統建設方案
2008年4月21日星期一
1. 項目背景
隨著高校信息化的發展,不論是老師還是學生都有課程上網的需求。課程上網後。一方面會有利於學生經常反復閱讀教學計劃和教學內容,更好地領會老師教學設計的用意,在一定程度上減輕學生記筆記和聽課不能兼顧的問題,另一方面也有利於老師對網上課程內容的不斷更新,便於老師改進教學,同時因為課程管理系統提供了方便的教學管理工具,老師教學的效率會大大提高。
2. 功能模塊
�8�5 操作員管理
只有系統管理員可以添加操作員,添加成功後便可以訪問課程管理系統。添加的操作員具有不同的角色,分為教師與學生兩種。
�8�5 課程管理
教師特有許可權,可以在互連網上直接對課程進行相應增、刪、改操作。
�8�5 學生成績信息管理
教師特有許可權,可以在互連網上直接對學生成績信息進行相應增、刪、改操作。
�8�5 學生成績查詢
學生登錄後只能查詢自己的成績信息。
3. 系統特色
�8�5 技術的先進性
採用B/S(JAVA)技術架構、大型sql資料庫技術使得系統在技術上處於絕對領先地位。
�8�5 完善的網路化管理策略
系統充分利用區域網和Intranet的網路化優勢,使得學校各教學崗位的教師對學生的管理實現網路化,學生也可通過網路得到與自己相關各項數據。
4. 方案設計
�8�5 軟體架構設計
本方案採用MVC三層架構,用戶使用瀏覽器以WEB方式使用系統的各個功能;業務層提供系統的各項功能與服務,包括操作員管理、課程管理、學生成績信息管理與學生成績查詢;業務層使用持久層組件來實現系統的各種業務數據的持久化。EIS層提供了數據的保存等工作。
�8�5 業務概述
系統管理員添加操作員成功以後,此操作員便可以登陸課程管理系統網站進行相應操作。此時系統將判斷登陸的操作員角色,如果為教師,那麼他能夠對課程信息做相應增、刪、改操作。還可以對學生課程信息進行相應增、刪、改操作。如果為學生,那麼他只能夠查詢自己的課程成績信息。
�8�5 關鍵技術
1) Struts框架:完美的MVC實現,便於日後系統的擴展。
2) Hibernate持久層框架:使用Hibernate技術實現系統數據持久化,同時簡化了數據的操作,使業務邏輯更加清晰。
『叄』 java學生管理系統
import java.applet.Applet;
import java.awt.*;
import java.awt.event.*;
import java.util.*;
import java.lang.*;
public class Students extends Applet implements ActionListener
{
Vector StuInf=new Vector();
StudentInf SI;
String xm;
String bj;
int i,j,xh,cj;
static int mid;
Label prompt1=new Label("學生成績管理系統");
Label prompt2=new Label(" 用戶:");
Label prompt3=new Label(" 密碼:");
Label prompt4=new Label(" 班級:");
Label prompt5=new Label(" 成績:");
TextField input1=new TextField(8);
TextField input2=new TextField(8);
TextField input3=new TextField(8);
TextField input4=new TextField(8);
Button btn1=new Button("登錄");
Button btn2=new Button("增加");
Button btn3=new Button("修改");
Button btn4=new Button("刪除");
public void init()
{
setLayout(new GridLayout(6,3));
add(new Label());
add(prompt1);
add(new Label());
add(prompt2);
add(input1);
add(new Label());
add(prompt3);
add(input2);
add(btn1);
add(prompt4);
add(input3);
add(new Label());
add(prompt5);
add(input4);
add(new Label());
add(btn2);
add(btn3);
add(btn4);
prompt4.setVisible(false);
prompt5.setVisible(false);
input3.setVisible(false);
input4.setVisible(false);
btn2.setVisible(false);
btn3.setVisible(false);
btn4.setVisible(false);
btn1.addActionListener(this);
btn2.addActionListener(this);
btn3.addActionListener(this);
btn4.addActionListener(this);
}
public void actionPerformed(ActionEvent e)
{
if(e.getActionCommand()=="登錄")
{
String a,b;
a=input1.getText();
b=input2.getText();
input1.setText("");
if((a.equals("12")==true)&&(b.equals("12")==true))
{
prompt2.setText(" 姓名:");
prompt3.setText(" 學號:");
prompt4.setVisible(true);
prompt5.setVisible(true);
input3.setVisible(true);
input4.setVisible(true);
btn2.setVisible(true);
btn3.setVisible(true);
btn4.setVisible(true);
btn3.setEnabled(false);
btn4.setEnabled(false);
btn1.setLabel("查詢");
input1.setText("登錄成功");
input1.selectAll();
}
else
input2.setText("用戶名或密碼錯");
}
if(e.getActionCommand()=="增加")
{
boolean scucss=true;
try
{
XingMing();
}
catch(EmptyException as)
{
input1.setText("姓名不能為空");
scucss=false;
}
try
{
xh=Integer.parseInt(input2.getText());
}
catch(NumberFormatException m)
{
input2.setText("學號為空或格式錯");
scucss=false;
}
bj=input3.getText();
try
{
ChengJi();
}
catch(EmptyException as)
{
cj=-1;
}
catch(OverException dd)
{
input4.setText("應在0-100間");
scucss=false;
}
catch(NumberFormatException cm)
{
input4.setText("成績應為數據");
scucss=false;
}
if(scucss==true)
{
SI=new StudentInf(xm,xh,bj,cj);
Insert(SI);
}
}
if(e.getActionCommand()=="修改")
{
xm=input1.getText();
xh=Integer.parseInt(input2.getText());
bj=input3.getText();
cj=Integer.parseInt(input4.getText());
SI=new StudentInf(xm,xh,bj,cj);
StuInf.setElementAt(SI, mid);
btn3.setEnabled(false);
}
if(e.getActionCommand()=="刪除")
{
StuInf.removeElementAt(mid);
btn4.setEnabled(false);
input1.setText("刪除成功");
input2.setText("");
input3.setText("");
input4.setText("");
}
if(e.getActionCommand()=="查詢")
{
boolean right=true;
try
{
xh=Integer.parseInt(input2.getText());
}
catch(NumberFormatException m)
{
input2.setText("學號為空或格式錯");
right=false;
}
if(right==true)
{
search(xh);
btn3.setEnabled(true);
btn4.setEnabled(true);
}
}
}
//查找方法
public void search(int k)
{
boolean exist=false;
int low=0;
int high=StuInf.size()-1;
while(low<=high)
{
mid=(high+low)/2;
StudentInf a1=(StudentInf) StuInf.elementAt(mid);
if(a1.getStuNo()==k)
{
SI=(StudentInf) StuInf.elementAt(mid);
String x = String.valueOf(SI.getStuNo());
exist=true;
input1.setText(SI.getname());
input1.selectAll();
input2.setText("0"+x);
input3.setText(SI.getClassNo());
if(SI.getLevel()==-1)
input4.setText("未參加考試");
else
{
String y = String.valueOf(SI.getLevel());
input4.setText(y);
}
break;
}
else if(a1.getStuNo()<k)
low=mid+1;
else
high=mid-1;
}
if(exist==false)
{
input1.setText("無此學號學生信息");
input1.selectAll();
}
}
//添加方法
public void Insert(StudentInf q)
{
int i=0;
if(StuInf.isEmpty()==true)
{
StuInf.addElement(q);
input1.setText("");
input2.setText("");
input3.setText("");
input4.setText("");
}
else
{
StudentInf xh;
xh=(StudentInf) StuInf.firstElement();
while(xh.getStuNo()<q.getStuNo())
{
i++;
if(i<StuInf.size())
xh=(StudentInf) StuInf.elementAt(i);
else
break;
}
if(xh.getStuNo()==q.getStuNo())
{
input2.setText("此學生信息已存在");
input2.requestFocus();
input2.selectAll();
}
else
{
StuInf.insertElementAt(q,i);
input1.setText("");
input2.setText("");
input3.setText("");
input4.setText("");
}
}
}
//異常類
class OverException extends Exception
{
String over;
}
class EmptyException extends Exception
{
String empty;
}
void XingMing() throws EmptyException
{
if((input1.getText()).equals(""))
throw (new EmptyException());
else
xm=input1.getText();
}
void ChengJi() throws OverException,EmptyException
{
if((input4.getText()).equals(""))
throw(new EmptyException());
else
cj=Integer.parseInt(input4.getText());
if(cj<0||cj>100)
throw (new OverException());
}
//學生信息類
public class StudentInf
{
private String name;
private int StuNo;
private String ClassNo;
private int Level;
StudentInf(String xingming,int xuehao,String banji,int chengji)
{
name=xingming;
StuNo=xuehao;
ClassNo=banji;
Level=chengji;
}
public int getStuNo()
{
return StuNo;
}
public String getname()
{
return name;
}
public String getClassNo()
{
return ClassNo;
}
public int getLevel()
{
return Level;
}
}
}
『肆』 怎麼用JAVA編寫一個班級管理系統
5.19軟體java班級免費下載
鏈接:https://pan..com/s/1J2uKomN_yWZHGthTR5HZOg
Java是一門面向對象編程語言,不僅吸收了C++語言的各種優點,還摒棄了C++里難以理解的多繼承、指針等概念,因此Java語言具有功能強大和簡單易用兩個特徵。Java語言作為靜態面向對象編程語言的代表,極好地實現了面向對象理論,允許程序員以優雅的思維方式進行復雜的編程 。
『伍』 如何用java製作學生管理系統
是要小型的還是大型的 小型的 需要資料庫嗎?下面這是個 控制台輸出的
importjava.util.List;
importjava.util.Scanner;
importcn.com.shxt.DBUtils.JdbcTool;
publicclassStudentManager{
/*
1.學生信息管理系統,界面如下
1--學生信息添加
2--全部學生信息查詢
3--查詢錄取學生的信息
4--按學號查詢錄取學生的信息
5--按姓名查詢錄取學生的信息
6--退出
*/
publicstaticvoidmain(String[]args){
Scannerscan=newScanner(System.in);
JdbcTooljt=newJdbcTool();
List<List<String>>tableList;
intflag;
Stringno;
Stringname;
Stringmain;
Stringpolitics;
StringEnglish;
StringMath;
StringMajor;
StringTotal;
Stringsql;
booleanpanan=true;
while(panan){
System.out.println();
System.out.println("===========歡迎進入研究生錄取系統================");
System.out.println("1--學生信息添加");
System.out.println("2--錄入學生信息查詢");
System.out.println("3--查詢錄取學生的信息");
System.out.println("4--按學號查詢錄取學生的信息");
System.out.println("5--按姓名查詢錄取學生的信息");
System.out.println("0--退出");
System.out.println("請輸入序號,選擇功能");
flag=scan.nextInt();
switch(flag){
case1:
System.out.println("請輸入學生的學號、姓名、報考專業、政治、英語、高數、專業課分數");
no=scan.next();
name=scan.next();
main=scan.next();
politics=scan.next();
English=scan.next();
Math=scan.next();
Major=scan.next();
inttotal=0;
total=Integer.parseInt(politics)+Integer.parseInt(English)+Integer.parseInt(Math)+Integer.parseInt(Major);
sql="insertintostumanager(s_no,s_name,s_main,s_politics,s_English,s_Math,s_Major,s_Total)values('"+no+"','"+name+"','"+main+"',"+politics+",'"+English+"','"+Math+"','"+Major+"','"+total+"')";
jt.update(sql);
System.out.println("添加成功");
break;
case2:
sql="select*fromstumanagerorderbys_totaldesc";
tableList=jt.query(sql);
if(tableList!=null&&tableList.size()>0){
tableList=jt.query(sql);
for(List<String>rowList:tableList){
System.out.println("id 學號 姓名 專業 政治 英語 高數 專業 總分 ");
System.out.println(rowList.get(0)+" "+rowList.get(1)+" "+rowList.get(2)+" "+rowList.get(3)+" "+rowList.get(4)+" "+rowList.get(5)+" "+rowList.get(6)+" "+rowList.get(7)+" "+rowList.get(8));
}
}else{
System.out.println("沒有學生信息,請添加~~");
break;
}
break;
case3:
System.out.println("請輸入報考專業以及政治、英語、高數、專業課、總分的分數");
main=scan.next();
politics=scan.next();
English=scan.next();
Math=scan.next();
Major=scan.next();
Total=scan.next();
sql="select*fromstumanagerwheres_main='"+main+"'ands_politics>="+politics+"ands_English>="+English+"ands_Math>="+Math+"ands_Major>="+Major+"ands_Total>="+Total+"";
tableList=jt.query(sql);
if(tableList.size()!=0){
tableList=jt.query(sql);
for(List<String>rowList:tableList){
System.out.println("id 學號 姓名 專業 政治 英語 高數 專業 總分 ");
System.out.println(rowList.get(0)+" "+rowList.get(1)+" "+rowList.get(2)+" "+rowList.get(3)+" "+rowList.get(4)+" "+rowList.get(5)+" "+rowList.get(6)+" "+rowList.get(7)+" "+rowList.get(8));
System.out.println("恭喜你,你被錄取了");
}
}else{
System.out.println("抱歉,你沒有被錄取");
break;
}
break;
case4:
System.out.println("請輸入要查詢的學生的學號以及政治、英語、高數、專業課、總分的錄取分數");
no=scan.next();
politics=scan.next();
English=scan.next();
Math=scan.next();
Major=scan.next();
Total=scan.next();
System.out.println("此學生的信息:");
sql="select*fromstumanagerwheres_politics>="+politics+"ands_English>="+English+"ands_Math>="+Math+"ands_Major>="+Major+"ands_Total>="+Total+"ands_no="+no+"";
tableList=jt.query(sql);
if(tableList!=null&&tableList.size()>0){
tableList=jt.query(sql);
for(List<String>rowList:tableList){
System.out.println("id 學號 姓名 專業 政治 英語 高數 專業 總分 ");
System.out.println(rowList.get(0)+" "+rowList.get(1)+" "+rowList.get(2)+" "+rowList.get(3)+" "+rowList.get(4)+" "+rowList.get(5)+" "+rowList.get(6)+" "+rowList.get(7)+" "+rowList.get(8));
System.out.println("恭喜你,你被錄取了");
}
}else{
System.out.println("抱歉,你沒有被錄取");
break;
}
break;
case5:
System.out.println("請輸入要查詢的學生姓名(單個文字也可)以及政治、英語、高數、專業課、總分的錄取分數");
name=scan.next();
politics=scan.next();
English=scan.next();
Math=scan.next();
Major=scan.next();
Total=scan.next();
sql="select*fromstumanagerwheres_politics>="+politics+"ands_English>="+English+"ands_Math>="+Math+"ands_Major>="+Major+"ands_Total>="+Total+"ands_namelike'%"+name+"%'";
tableList=jt.query(sql);
if(tableList!=null&&tableList.size()>0){
tableList=jt.query(sql);
for(List<String>rowList:tableList){
System.out.println("id 學號 姓名 專業 政治 英語 高數 專業 總分 ");
System.out.println(rowList.get(0)+" "+rowList.get(1)+" "+rowList.get(2)+" "+rowList.get(3)+" "+rowList.get(4)+" "+rowList.get(5)+" "+rowList.get(6)+" "+rowList.get(7)+" "+rowList.get(8));
System.out.println("恭喜你,你被錄取了");
}
}else{
System.out.println("抱歉,你沒有被錄取");
break;
}
break;
case0:
panan=false;
break;
}
}
}
}
『陸』 簡單的java學生信息管理系統
package bean; public class Student { String name; String studentId; String sex; int grade; public Student(String name,String studentId,String sex,int grade){ this.name= name; this.studentId= studentId; this.sex = sex; this.grade = grade; } public int getGrade(){ return grade; } public String getName(){ return name; } public String getSex(){ return sex; } public void setGrade(int g){ this.grade = g; } public String getStudentId(){ return studentId; } }
System.out.println("***************"); System.out.println("*歡迎來到學生管理系統 *"); System.out.println("*1:增加學生 *"); System.out.println("*2:刪除學生 *"); System.out.println("*3:修改成績 *"); System.out.println("*4:查詢成績 *"); System.out.println("***************"); System.out.println("您想選擇的操作是:");
import java.util.*;
Scanner sc = new Scanner(System.in); int choice = sc.nextInt();
package test; import java.util.*; import bean.Student; public class Manager { static List<Student> StudentList = new LinkedList<Student>(); public static void main(String[] agrs){ select(StudentList); } private static void select(List<Student> StudentList ){ System.out.println("***************"); System.out.println("*歡迎來到學生管理系統 *"); System.out.println("*1:增加學生 *"); System.out.println("*2:刪除學生 *"); System.out.println("*3:修改成績 *"); System.out.println("*4:查詢成績 *"); System.out.println("***************"); System.out.println("您想選擇的操作是:"); Scanner sc = new Scanner(System.in); int choice = sc.nextInt(); switch(choice){ //增加學生 case 1: System.out.print("請輸入學生的姓名:"); Scanner Sname = new Scanner(System.in); String name = Sname.nextLine(); System.out.print("請輸入學生的性別:"); Scanner Ssex = new Scanner(System.in); String sex = Ssex.nextLine(); System.out.print("請輸入學生的學號:"); Scanner SId = new Scanner(System.in); String studentId = SId.nextLine(); System.out.print("請輸入學生的成績:"); Scanner Sgrade = new Scanner(System.in); int grade = Sgrade.nextInt(); StudentList.add(new Student(name,studentId,sex,grade)); System.out.println("添加成功!!!!!"); select(StudentList); break; //刪除學生成績 case 2: System.out.print("請告訴我需要刪除學生的學號:"); Scanner Sid = new Scanner(System.in); String SstudentId = Sid.nextLine(); boolean isfindDelete = false; for (int i = 0; i < StudentList.size(); i++) { if(SstudentId.equals(StudentList.get(i).getStudentId())){ System.out.println("發現了該學生,正在刪除..."); StudentList.remove(i); System.out.println("刪除成功!!!"); isfindDelete =true; } } if(!isfindDelete){ System.out.println("抱歉,沒有找到"); } select(StudentList); break; //修改學生成績 case 3: System.out.print("請告訴我需要修改成績學生的學號:"); Scanner GId = new Scanner(System.in); String GstudentId = GId.nextLine(); boolean isfindChange = false; for (int j = 0; j < StudentList.size(); j++) { if(GstudentId.equals(StudentList.get(j).getStudentId())){ System.out.println("發現了該學生,正在修改..."); System.out.println("學生原成績為"+StudentList.get(j).getGrade()); System.out.print("請輸入修改後學生的成績:"); Scanner Ggrade = new Scanner(System.in); int grade2 = Ggrade.nextInt(); StudentList.get(j).setGrade(grade2); System.out.println("修改成功!!!"); isfindChange =true; }else{ } } if(!isfindChange){ System.out.println("抱歉,沒有找到"); } select(StudentList); break; //查看學生成績 case 4: System.out.print("請告訴我需要查詢學生的學號:"); Scanner CId = new Scanner(System.in); String CstudentId = CId.nextLine(); boolean isfindData = false; for (int i = 0; i < StudentList.size(); i++) { if(CstudentId.equals(StudentList.get(i).getStudentId())){ System.out.println("名字:"+StudentList.get(i).getName()); System.out.println("性別:"+StudentList.get(i).getSex()); System.out.println("學號:"+StudentList.get(i).getStudentId()); System.out.println("成績:"+StudentList.get(i).getGrade()); isfindData = true; } } if(!isfindData){ System.out.println("抱歉,沒有找到"); } select(StudentList); break; default: System.out.println("您輸入的數字有誤,請重新輸入:"); break; } } }
『柒』 用java編寫學生管理系統
package com.tree;
import java.util.Arrays;
public class StudentDemo {
private int[] temp;
public StudentDemo(int[] temp) {
this.temp = temp;
}
public void printAllGrade() {
if (temp != null) {
for (int i = 0; i < temp.length; i++) {
System.out.println("學號 " + (i + 1) + ":" + temp[i]);
}
} else {
System.out.println("參數有誤!");
}
}
public void printAvarage() {
if (temp != null) {
Arrays.sort(temp);// 排序數據
double sum=0.00;
for (int i = 0; i < temp.length; i++) {
sum+=temp[i];
}
System.out.println("平均分 :" + sum/temp.length);
System.out.println("最高分 :" + temp[temp.length-1]);
System.err.println("最低分 :" + temp[0]);
} else {
System.out.println("參數有誤!");
}
}
public void printDistribution(){
if(temp!=null){
Arrays.sort(temp);// 排序數據
StringBuffer a10 = new StringBuffer();//00-09
StringBuffer a20 = new StringBuffer();//10-19
StringBuffer a30 = new StringBuffer();//20-29
StringBuffer a40 = new StringBuffer();//30-39
StringBuffer a50 = new StringBuffer();//40-49
StringBuffer a60 = new StringBuffer();//50-59
StringBuffer a70 = new StringBuffer();//60-69
StringBuffer a80 = new StringBuffer();//70-79
StringBuffer a90 = new StringBuffer();//80-89
StringBuffer a99 = new StringBuffer();//90-99
StringBuffer a100 = new StringBuffer();//一百分;
for (int i = 0; i < temp.length; i++) {
if (temp[i] < 10) {
a10.append("*");
} else if (temp[i] < 20) {
a20.append("*");
} else if (temp[i] < 30) {
a30.append("*");
} else if (temp[i] < 40) {
a40.append("*");
} else if (temp[i] < 50) {
a50.append("*");
} else if (temp[i] < 60) {
a60.append("*");
} else if (temp[i] < 70) {
a70.append("*");
} else if (temp[i] < 80) {
a80.append("*");
} else if (temp[i] < 90) {
a90.append("*");
} else if(temp[i] <100){
a100.append("*");
}else {
a100.append("*");
}
}
System.out.println("00-09: "+a10);
System.out.println("10-19: "+a20);
System.out.println("20-29: "+a30);
System.out.println("30-39: "+a40);
System.out.println("40-49: "+a50);
System.out.println("50-59: "+a60);
System.out.println("60-69: "+a70);
System.out.println("70-79: "+a80);
System.out.println("80-89: "+a90);
System.out.println("90-99: "+a99);
System.out.println("100:"+a100);
}else{
System.out.println("參數有誤!");
}
}
public static void main(String[] args) {
int[] gradesArray = { 87, 68, 94, 100, 83, 78, 85, 91, 76, 87 };
StudentDemo s = new StudentDemo(gradesArray);
s.printAllGrade();
s.printDistribution();
s.printAvarage();
}
}
printMax() 輸出學生的最高成績 和 printMin() 輸出學生的最低成績 我為了方便就直接放到printAvarage()裡面了,你自己看下就明白;
這題太簡單了,給分吧;
『捌』 怎麼用java做一個簡單的學生管理系統
用java寫的話,可以用List來實現學生管理系統:
首先,管理系統是針對學生對象的,所以我們先把學生對象就寫出來:
package bean;
public class Student {
String name;
String studentId;
String sex;
int grade;
public Student(String name,String studentId,String sex,int grade){
this.name= name;
this.studentId= studentId;
this.sex = sex;
this.grade = grade;
}
public int getGrade(){
return grade;
}
public String getName(){
return name;
}
public String getSex(){
return sex;
}
public void setGrade(int g){
this.grade = g;
}
public String getStudentId(){
return studentId;
}
}
這裡面定義了一些得到當前學生對象數據的一些get方法,和成績修改的set方法,代碼很簡單,就不做詳細的解答。
就下來就是我們的正文了。
雖然我們暫時不用swing來做界面,但是總得要看的過去吧,所以,先做了一個比較簡單的界面:
System.out.println("***************");
System.out.println("*歡迎來到學生管理系統 *");
System.out.println("*1:增加學生 *");
System.out.println("*2:刪除學生 *");
System.out.println("*3:修改成績 *");
System.out.println("*4:查詢成績 *");
System.out.println("***************");
System.out.println("您想選擇的操作是:");
這里可以看到,我們的是用一個1234來選擇項目,說以不得不講一下Java如何獲取到鍵盤所輸入的數據---------Scanner ,要使用這個,首先需要import進來一個包:
例如這里:
import java.util.*;
之後的兩行代碼搞定輸入:
Scanner sc = new Scanner(System.in);
int choice = sc.nextInt();
接下來就是各個功能的實現:
package test;
import java.util.*;
import bean.Student;
public class Manager {
static List<Student> StudentList = new LinkedList<Student>();
public static void main(String[] agrs){
select(StudentList);
}
private static void select(List<Student> StudentList ){
System.out.println("***************");
System.out.println("*歡迎來到學生管理系統 *");
System.out.println("*1:增加學生 *");
System.out.println("*2:刪除學生 *");
System.out.println("*3:修改成績 *");
System.out.println("*4:查詢成績 *");
System.out.println("***************");
System.out.println("您想選擇的操作是:");
Scanner sc = new Scanner(System.in);
int choice = sc.nextInt();
switch(choice){
//增加學生
case 1:
System.out.print("請輸入學生的姓名:");
Scanner Sname = new Scanner(System.in);
String name = Sname.nextLine();
System.out.print("請輸入學生的性別:");
Scanner Ssex = new Scanner(System.in);
String sex = Ssex.nextLine();
System.out.print("請輸入學生的學號:");
Scanner SId = new Scanner(System.in);
String studentId = SId.nextLine();
System.out.print("請輸入學生的成績:");
Scanner Sgrade = new Scanner(System.in);
int grade = Sgrade.nextInt();
StudentList.add(new Student(name,studentId,sex,grade));
System.out.println("添加成功!!!!!");
select(StudentList);
break;
//刪除學生成績
case 2:
System.out.print("請告訴我需要刪除學生的學號:");
Scanner Sid = new Scanner(System.in);
String SstudentId = Sid.nextLine();
boolean isfindDelete = false;
for (int i = 0; i < StudentList.size(); i++) {
if(SstudentId.equals(StudentList.get(i).getStudentId())){
System.out.println("發現了該學生,正在刪除...");
StudentList.remove(i);
System.out.println("刪除成功!!!");
isfindDelete =true;
}
}
if(!isfindDelete){
System.out.println("抱歉,沒有找到");
}
select(StudentList);
break;
//修改學生成績
case 3:
System.out.print("請告訴我需要修改成績學生的學號:");
Scanner GId = new Scanner(System.in);
String GstudentId = GId.nextLine();
boolean isfindChange = false;
for (int j = 0; j < StudentList.size(); j++) {
if(GstudentId.equals(StudentList.get(j).getStudentId())){
System.out.println("發現了該學生,正在修改...");
System.out.println("學生原成績為"+StudentList.get(j).getGrade());
System.out.print("請輸入修改後學生的成績:");
Scanner Ggrade = new Scanner(System.in);
int grade2 = Ggrade.nextInt();
StudentList.get(j).setGrade(grade2);
System.out.println("修改成功!!!");
isfindChange =true;
}else{
}
}
if(!isfindChange){
System.out.println("抱歉,沒有找到");
}
select(StudentList);
break;
//查看學生成績
case 4:
System.out.print("請告訴我需要查詢學生的學號:");
Scanner CId = new Scanner(System.in);
String CstudentId = CId.nextLine();
boolean isfindData = false;
for (int i = 0; i < StudentList.size(); i++) {
if(CstudentId.equals(StudentList.get(i).getStudentId())){
System.out.println("名字:"+StudentList.get(i).getName());
System.out.println("性別:"+StudentList.get(i).getSex());
System.out.println("學號:"+StudentList.get(i).getStudentId());
System.out.println("成績:"+StudentList.get(i).getGrade());
isfindData = true;
}
}
if(!isfindData){
System.out.println("抱歉,沒有找到");
}
select(StudentList);
break;
default:
System.out.println("您輸入的數字有誤,請重新輸入:");
break;
}
}
}
可以看見,我把所有的實現過程全部放在select();方法中了,這樣可以避免我選擇完了一個操作後不能繼續其他操作。大部分的操作都是依靠for循環來遍歷操作,方便快捷。
『玖』 基於JAVA的學生信息管理系統
2、教學管理:教學信息管理模塊主要實現各種與教學相關信息的設置和維護的操作,包括以下幾方面的內容:院系設置、專業設置、年級設置、班級設置、學期設置、課程開設等 3、學籍管理:學生學籍管理模塊主要實現對學生基本信息的設置和維護,提供學生信息的錄入和查詢頁面,並對學生班級更改情況進行維護等,它包括以下幾方面的內容:學生基本信息維護和查詢、學生增減、批量導入學生信息並自動生成學號。 其中,學生基本信息的錄入、維護和查詢統計功能是每個學生必須完成的功能,而學生增減和批量導入學生信息並自動生成學號則是有能力的學生可以在時間充裕的前提下進一步完成。 4、成績管理:學生成績管理模塊主要實現對學生選修課程以及所選課程的成績信息的設置和維護。 它包括以下幾方面的內容:學生選課管理、學生成績管理兩部分。銷售管理系統的主要任務是建立、維護客戶信息檔案、統計、匯總產品信息,進行定單的錄入、維護等。要求編寫Java GUI程序實現上述功能。 3 課程設計報告書主要內容1 需求分析2 總體設計2.1 設計的總體思想與演算法描述 2.2 模塊結構圖 2.3 各功能模塊的功能與處理流程描述 2.4 界面設計 3 各功能模塊程序設計 按照功能模塊的功能與處理流程描述給出詳細的程序代碼,並給出重點語句的注釋. 4 小結4 課程設計要求 1 按時到機房簽到,在指定機位上機。遵守機房紀律。 2 獨立完成課程設計任務。指導教師到機位上指導學生和分時段驗收學生完成的程序。 3 按時提交列印的課程設計報告書。 5 課程設計參考書 1 許文憲 懂子建. Java程序設計教程與實訓 北京:北京大學出版社,2005. 2 辛運幃 .Java程序設計.北京:清華大學出版社, 2004 3 蔡翠平 .Java程序設計.北京:清華大學出版社,2003