本文目錄一覽:
- 1、java設計一個學生成績管理系統?
- 2、JAVA:編寫一個學生成績管理系統。學生的屬性包括學號、姓名、年齡等。
- 3、如何用Java語言編寫學生成績管理系統
- 4、用java編寫一個學生成績管理系統. //1.學生類 學號 姓名 年齡 語數外三科成績(三科成績)?
- 5、用java做一個學生成績管理系統需要哪些技術?
- 6、基於java設計一個學生成績管理系統,要求有界面,且有增加,查詢,修改,刪除,退出功能,代碼如何寫?
java設計一個學生成績管理系統?
public static void main(String[] args) throws IOException {
Scanner sc = new Scanner(System.in);
String exit=””;
MapString, ListFloat map1=new HashMap();
while(!exit.equals(“exit”)) {
System.out.println(“請出入學生姓名”);
ListFloat list = new ArrayListFloat();
map1.put(sc.next(), list);
for(int i=0;i3;i++) {
System.out.println(“請出入學生成績”);
list.add(sc.nextFloat());
}
System.out.println(“輸入 exit 退出成績錄入,其他則繼續錄入”);
exit=sc.next();
}
for(String key :map1.keySet()) {
ListFloat list =map1.get(key);
float avage =0l;
for(Float box :list) {
avage += box;
}
System.out.println(key+”的平均成績:”+ avage/list.size());
}
}
//只做了第一題,追加分數,可得第二題答案
JAVA:編寫一個學生成績管理系統。學生的屬性包括學號、姓名、年齡等。
class Student{
String name;
String id;
int age;
Couse[] course;
}
class Course{
String coursename;
float pscourse;
float qzcourse;
float sxcourse;
float qmcourse;
float zpcourse;
}
這個要寫好長時間的,定義幾個類;然後實現具體的功能。用數組或者集合來存儲學生信息還有成績信息,最後定義一個測試類。你可以找我私聊,1368270359qq
如何用Java語言編寫學生成績管理系統
package student;
import java.util.Scanner;
public class teststudent {
public static void main(String args[]){
System.out.println(“************************學生成績管理系統*********************”);
System.out.println(“請輸入要管理的學生人數:”);
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
studentMassage stum = new studentMassage(n);
int flag = 1;
while(flag == 1){
System.out.println(“1.輸入學生信息”);
System.out.println(“2.通過姓名查找學生信息”);
System.out.println(“3.顯示全部學生信息”);
System.out.println(“4.退出系統”);
int op = sc.nextInt();
switch(op){
case 1:stum.addStudent(n);
new Scanner(System.in).nextLine();
break;
case 2:
System.out.println(“輸入學生姓名:”);
String name = sc.next();
stum.FindStudent(name);
new Scanner(System.in).nextLine();
break;
case 3:
stum.showallStudent();
new Scanner(System.in).nextLine();
break;
case 4:
flag = 0;
System.out.println(“已退出系統!”);
break;
default:
System.out.println(“輸入有誤!”);
new Scanner(System.in).nextLine();
}
}
}
}
class Date{
int year;
int month;
int day;
/*public Date(int year,int month,int day){
this.year = year;
this.month = month;
this.day = day;
}
public Date(){}*/
public String showDate(){
return year + “/”+ month+”/”+day;
}
}
class student{
int id;
String name;
Date date;
float score;
public student(){
id = 0;
name = null;
date = null;
score = 0f;
}
public void showStudent(){
System.out.println( id + ” ” + name + ” “+ ” ” + date.showDate()+” “+score);
}
}
class studentMassage{
private student[] stu;
private int flag;
public studentMassage(int n){
flag = 0;
if(stu == null){
stu = new student[n];
for(int i =0;in;++i){
stu[i] = new student();
}
}
}
public void addStudent(int n){
flag = 1;
Scanner sc = new Scanner(System.in);
System.out.println(“請輸入”+n+”個學生信息”);
for(int i = 0 ;istu.length;++i){
stu[i].date = new Date();
System.out.println(“請輸入第”+(i+1)+”個學生學號:”);
stu[i].id = sc.nextInt();
System.out.println(“請輸入第”+(i+1)+”個學生姓名:”);
stu[i].name = sc.next();
System.out.println(“請輸入第”+(i+1)+”個學生出生年份:”);
stu[i].date.year = sc.nextInt();
System.out.println(“請輸入第”+(i+1)+”個學生出生月份:”);
stu[i].date.month = sc.nextInt();
System.out.println(“請輸入第”+(i+1)+”個學生出生日期:”);
stu[i].date.day = sc.nextInt();
//stu[i].date = new Date(year,month,day);
System.out.println(“請輸入第”+(i+1)+”個學生分數:”);
stu[i].score = sc.nextFloat();
}
}
public void FindStudent(String sname){
student find = null;
if(flag != 0){
for(int i = 0;istu.length;++i){
if(sname.equals(stu[i].name))
find = stu[i];
}
if(find == null)
System.out.println(“查無此人!”);
else
find.showStudent();
}else
System.out.println(“沒有輸入學生信息!”);
}
public void showallStudent(){
System.out.println(“所有學生的信息如下:”);
System.out.println(“學號 姓名 生日 分數”);
for(int i = 0;istu.length;++i){
stu[i].showStudent();
}
}
}
用java編寫一個學生成績管理系統. //1.學生類 學號 姓名 年齡 語數外三科成績(三科成績)?
用數組可以,也可以用集合來存儲各個同學的成績。
添加刪除等信息簡單。
這裡有個迷你圖書管理系統,類似,我剛寫的。你看看之後應該會有思路了。如果用集合utils做的話,也簡單,知識用到了集合框架和泛型等機制。
package cn.kgc.sg.MiTuSys;
import java.util.Scanner;
public class MiNiBookSys {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
// 定義書的信息
String[] bookNames = new String[4];
int[] borrowDate = new int[5];
int[] borrowCount = new int[4];
int[] states = new int[4];
// 定義書單信息
String[] bookMeg = new String[5];
bookMeg[0] = “Java開發”;
bookMeg[1] = “C#開發”;
bookMeg[2] = “C語言開發”;
states[2] = 0; // 0:可借閱 1:已借出
// 初始化兩個圖書借閱記錄信息
bookNames[0] = “安徒生童話”;
borrowDate[0] = 15;
borrowCount[0] = 4;
states[0] = 0; // 0:可借閱 1:已借出
bookNames[1] = “格林童話”;
states[1] = 1; // 0:可借閱 1:已借出
borrowDate[1] = 26;
borrowCount[1] = 9;
// 搭建項目框架
int num = -1;// 定義用戶初始輸入的數字
do {
System.out.println(“*********************歡迎使用圖書管理系統**********************”);
System.out.println(“\t\t\t1.新增圖書”);
System.out.println(“\t\t\t2.查看圖書”);
System.out.println(“\t\t\t3.刪除圖書”);
System.out.println(“\t\t\t4.圖書借閱”);
System.out.println(“\t\t\t5.歸還圖書”);
System.out.println(“\t\t\t6.退出系統”);
System.out.print(“請輸入您的選擇:”);
int choose = sc.nextInt();
// 判斷輸入的選擇是否正確
while (choose 0 || choose 6) {
System.out.print(“輸入有誤,請重新輸入:”);
choose = sc.nextInt();
}
// 定義一個flag變量,來定義是否退出系統
boolean flag = true;// true:不退出系統 false:退出系統
String addName = null;
switch (choose) {
case 1:
System.out.println(“\n*********1.新增圖書*********”);
boolean isAdd = true;
System.out.println(“序號\t\t圖書書名”);
for (int i = 0; i bookMeg.length; i++) {
// 判斷為空的不輸出
if (bookMeg[i] != null) {
System.out.println((i + 1) + “\t\t” + bookMeg[i]);
}
}
System.out.print(“請輸入新增圖書名稱:”);
addName = sc.next();
for (int i = 0; i bookMeg.length; i++) {
// 判斷為空的不輸出
if (bookMeg[i] == null) {
bookMeg[i] = addName;
break;
}
}
/*bookMeg[bookMeg.length-1] = addName; //添加圖書信息
*/ System.out.println(“\n序號\t\t圖書書名”);
for (int i = 0; i bookMeg.length; i++) {
// 判斷為空的不輸出
if (bookMeg[i] != null) {
System.out.println((i + 1) + “\t\t” + bookMeg[i]);
}
}
if (!isAdd) {
System.out.println(“對不起,圖書已滿,不能添加!!!”);
}
break;
case 2:
System.out.println(“\n*********2.查看圖書*********”);
System.out.println(“序號” + “\t圖書書名” + “\t 借閱次數 \t借閱狀態\t借閱日期\t”);
// 遍曆數組
for (int i = 0; i bookNames.length; i++) {
// 判斷信息為空的不輸出
if (bookNames[i] != null) {
String borrowCounts = borrowCount[i] + “次”;
String borrowDates = borrowDate[i] + “日”;
String state = (states[i] == 0) ? “可借閱” : “已借出”;
System.out.println((i + 1) + “\t” + bookNames[i] + “\t ” + borrowCounts + “\t ” + state
+ “\t ” + borrowDates);
}
}
break;
case 3:
System.out.println(“\n*********3.刪除圖書*********”);
System.out.println(“序號\t\t圖書書名”);
for (int i = 0; i bookMeg.length; i++) {
// 判斷為空的不輸出
if (bookMeg[i] != null) {
System.out.println((i + 1) + “\t\t” + bookMeg[i]);
}
}
System.out.print(“請輸入刪除的圖書序號:”);
int delNo = sc.nextInt();
// 判斷輸入的序號是否有誤
while (delNo 1 || delNo bookMeg.length) {
System.out.print(“輸入有誤,重新輸入:”);
delNo = sc.nextInt();
}
// 刪除圖書
for (int i = 0; i =bookMeg.length-1;i++) {
if (bookMeg[i] != null i == delNo – 1) {
bookMeg[i] = bookMeg[i+1];
bookMeg[i+1] = null; //
// 最後置空
bookMeg[bookMeg.length – 1] = null;
}
}
for (int i = 0; i bookMeg.length; i++) {
// 判斷為空的不輸出
if (bookMeg[i] != null) {
System.out.println((i + 1) + “\t\t” + bookMeg[i]);
}
}
break;
case 4:
System.out.println(“\n*********4.圖書借閱*********”);
System.out.println(“\n序號\t\t圖書書名\t\t借閱狀態\t\t借閱次數\t\t借閱日期”);
for (int i = 0; i bookMeg.length; i++) {
// 判斷為空的不輸出
if (bookMeg[i] != null) {
String state = (states[i] == 0) ? “可借閱” : “已借出”;
String borrowCi = borrowCount[i] + “次”;
System.out.println((i + 1) + “\t\t” + bookMeg[i] + “\t\t” + state + “\t\t” + borrowCi + “\t\t”
+ borrowDate[i]);
}
}
System.out.print(“請輸入您要借閱的圖書序號:”);
int borrowNo = sc.nextInt();
boolean isFind = true;// false:找不到
for (int i = 0; i bookMeg.length; i++) {
// 查到了,但是狀態是0可借閱,可以借閱
if (i == borrowNo – 1 states[i] == 0) {
isFind = true;
// 改變狀態為已借出
states[i] = 1;
// 借閱次數加一
borrowCount[i]++;
// 輸入借閱日期
System.out.print(“請輸入借閱日期:”);
int borrow = sc.nextInt();
// 對輸入的日期判斷
while (borrow 1 || borrow 31) {
System.out.print(“您輸入日期有誤,請重新輸入:”);
borrow = sc.nextInt();
}
// 更新借閱日期
borrowDate[i] = borrow;
} else if (i == borrowNo – 1 states[i] == 1) {
// 查到了,但是狀態是1已借出,不可以借閱
isFind = true;
System.out.println(“狀態是已借出,不可以借閱!!!”);
}
}
if (!isFind) {
System.out.println(“找不到圖書!”);
break;
}
break;
case 5:
System.out.println(“\n*********5.歸還圖書*********”);
System.out.println(“\n序號\t\t圖書書名\t\t借閱狀態\t\t借閱次數\t\t借閱日期”);
for (int i = 0; i bookMeg.length; i++) {
// 判斷為空的不輸出
if (bookMeg[i] != null) {
String state = (states[i] == 0) ? “可借閱” : “已借出”;
String borrowCi = borrowCount[i] + “次”;
System.out.println((i + 1) + “\t\t” + bookMeg[i] + “\t\t” + state + “\t\t” + borrowCi + “\t\t”
+ borrowDate[i]);
}
}
System.out.print(“請輸入您要歸還的圖書序號:”);
int huanNo = sc.nextInt();
// 判斷歸還的序號是否合法
while (huanNo 1 || huanNo bookMeg.length – 1) {
System.out.print(“輸入的歸還圖書序號有誤,請重新輸入:”);
huanNo = sc.nextInt();
}
boolean isHuan = true;// false:找不到
for (int i = 0; i bookMeg.length; i++) {
// 查到了,但是狀態是1已借出,可以還
if (i == huanNo – 1 states[i] == 1) {
isHuan = true;
// 改變狀態為已借出
states[i] = 0;
// 輸入歸還日期
System.out.print(“請輸入歸還日期:”);
int huan = sc.nextInt();
// 對歸還的日期判斷,必須大於借閱日期
while (huan 1 || huan 31) {
System.out.print(“您輸入日期有誤,請重新輸入(1-31):”);
huan = sc.nextInt();
}
while (huan borrowDate[i]) {
System.out.print(“歸還日期必須大於借閱日期” + borrowDate[i] + “號,請重新輸入:”);
huan = sc.nextInt();
}
borrowCount[i]++;
System.out.println(“歸還圖書成功!!!”);
} else if (i == huanNo – 1 states[i] == 0) {
// 查到了,但是狀態是0可借閱,不能還
isFind = true;
System.out.println(“狀態是可借閱,不可以歸還!!!”);
}
}
if (!isHuan) {
System.out.println(“抱歉,找不到圖書,不能歸還圖書!”);
break;
}
break;
case 6:
System.out.println(“\n*********6.退出系統*********”);
flag = false;
break;
default:
flag = false;
break;
}
if (flag) {
System.out.print(“輸入0返回:”);
num = sc.nextInt();
} else {
break;
}
} while (num == 0);
System.out.println(“**********謝謝使用**********”);
}
}
希望能幫到你!!!
用java做一個學生成績管理系統需要哪些技術?
用java做一個學生成績管理系統,可以用到如下技術:
後台:ssh框架,不用框架的話,單純地用jsp
+
servlet也可以。
前台:html
+
css
+
js
+
jquery
數據庫:掌握sql語言的編寫,數據庫的連接。複雜的項目還需要用到存儲過程。
基於java設計一個學生成績管理系統,要求有界面,且有增加,查詢,修改,刪除,退出功能,代碼如何寫?
import java.awt.Color;
import java.awt.Font;
import java.awt.Frame;
import java.awt.Label;
import java.awt.TextField;
import java.awt.Window;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.sql.SQLException;
import javax.swing.JButton;
public class Stmessege {
Font font = new Font(“楷體”, Font.BOLD, 18);
private Frame m = new Frame(“登陸成功界面”);
protected Window f;
public Stmessege() {
m.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent evt) {
m.setVisible(false);
m.dispose();
System.exit(0);
}
});
m.setSize(460, 360);
m.setBackground(Color.green);
m.setLayout(null);
m.setLocationRelativeTo(null);
Label l0 = new Label(“管理員信息”);
Font font1 = new Font(“楷體”, Font.BOLD, 32);
l0.setForeground(Color.blue);
l0.setSize(180, 50);
l0.setLocation(150, 30);
l0.setFont(font1);
final Label l1 = new Label(“姓名:”);
l1.setSize(60, 20);
l1.setLocation(10, 100);
l1.setFont(font);
TextField tf1 = new TextField(“黃朋”);
tf1.setForeground(Color.blue);
tf1.setBackground(Color.white);
tf1.setSize(50, 20);
tf1.setLocation(70, 100);
final Label l2 = new Label(“學號:”);
l2.setSize(60, 20);
l2.setLocation(140, 100);
l2.setFont(font);
TextField tf2 = new TextField(“111265”);
tf2.setForeground(Color.blue);
tf2.setBackground(Color.white);
tf2.setSize(60, 20);
tf2.setLocation(190, 100);
final Label l3 = new Label(“性別:”);
l3.setSize(60, 20);
l3.setLocation(280, 100);
l3.setFont(font);
TextField tf3 = new TextField(“男”);
tf3.setForeground(Color.blue);
tf3.setBackground(Color.white);
tf3.setSize(40, 20);
tf3.setLocation(360, 100);
final Label l4 = new Label(“班級:”);
l4.setSize(60, 20);
l4.setLocation(10, 170);
l4.setFont(font);
TextField tf4 = new TextField(“611231”);
tf4.setForeground(Color.blue);
tf4.setBackground(Color.white);
tf4.setSize(60, 20);
tf4.setLocation(67, 170);
final Label l5 = new Label(“系別:”);
l5.setSize(60, 20);
l5.setLocation(140, 170);
l5.setFont(font);
TextField tf5 = new TextField(“計算機工程系”);
tf5.setForeground(Color.blue);
tf5.setBackground(Color.white);
tf5.setSize(80, 20);
tf5.setLocation(200, 170);
final Label l6 = new Label(“成績:”);
l6.setSize(60, 20);
l6.setLocation(280, 170);
l6.setFont(font);
TextField tf6 = new TextField(“95”);
tf6.setForeground(Color.blue);
tf6.setBackground(Color.white);
tf6.setSize(40, 20);
tf6.setLocation(360, 170);
final Label l7 = new Label(“專業:”);
l7.setSize(60, 20);
l7.setLocation(10, 230);
l7.setFont(font);
TextField tf7 = new TextField(“軟件技術”);
tf7.setForeground(Color.blue);
tf7.setBackground(Color.white);
tf7.setSize(60, 20);
tf7.setLocation(70, 230);
JButton btn1 = new JButton(“添加”);
btn1.setForeground(Color.blue);
btn1.setSize(80, 38);
btn1.setLocation(35, 300);
btn1.setFont(font);
btn1.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
new 插入();
m.setVisible(true);
}
});
JButton btn2 = new JButton(“查詢學生學籍信息”);
btn2.setForeground(Color.blue);
btn2.setSize(200, 38);
btn2.setLocation(135, 300);
btn2.setFont(font);
btn2.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
Stmessege1 f;
try {
f = new Stmessege1();
f.Stmessege11();
m.setVisible(true);
} catch (SQLException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
} catch (ClassNotFoundException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
}
});
JButton btn3 = new JButton(“刪除”);
btn3.setForeground(Color.blue);
btn3.setSize(80, 38);
btn3.setLocation(350, 300);
btn3.setFont(font);
btn3.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
new 刪除();
//f.setVisible(false);
m.setVisible(true);
}
});
JButton btn4 = new JButton(“更新”);
btn4.setForeground(Color.blue);
btn4.setSize(80, 38);
btn4.setLocation(200, 230);
btn4.setFont(font);
btn4.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
new 更新();
m.setVisible(true);
}
});
m.add(l0);
m.add(l1);
m.add(tf1);
m.add(l2);
m.add(tf2);
m.add(l3);
m.add(tf3);
m.add(l4);
m.add(tf4);
m.add(l5);
m.add(tf5);
m.add(l6);
m.add(tf6);
m.add(l7);
m.add(tf7);
m.add(btn1);
m.add(btn2);
m.add(btn3);
m.add(btn4);
m.setVisible(true);
}
public static void main(String[] args) {
new Stmessege();
}
}
可以仿照我的做一下,希望採納,我才一級哦
原創文章,作者:WYTM,如若轉載,請註明出處:https://www.506064.com/zh-hant/n/143892.html