「java学生院系」java学生系统管理

博主:adminadmin 2023-03-19 09:55:08 553

本篇文章给大家谈谈java学生院系,以及java学生系统管理对应的知识点,希望对各位有所帮助,不要忘了收藏本站喔。

本文目录一览:

Java模拟学院 系 教师 学生的关系

从人Person开始:

package schools;

public class Person {

private String name;

private String se;

private int age;

public String getName() {

return name;

}

public void setName(String name) {

this.name = name;

}

public String getSe() {

return se;

}

public void setSe(String se) {

this.se = se;

}

public int getAge() {

return age;

}

public void setAge(int age) {

this.age = age;

}

}

完整代码见附件!

JAVA编写三个系别的学生类:英语系,计算机系,文学系(要求通过继承学生类)

文件名保存为Test.java

import java.util.Random;

public class Test {

public static void main(String[] args) {

Student[] students = new Student[5];

Random rand = new Random();

//EnglishMajor student 001

EnglishMajor englishStu001 = new EnglishMajor();

createStudent(rand, englishStu001);

englishStu001.setName("English major student 001");

englishStu001.setPresentationScore(rand.nextInt(101));

englishStu001.setSex('F');

students[0] = englishStu001;

// ArtMajor student 001

ArtMajor artMajorStu = new ArtMajor();

createStudent(rand, artMajorStu);

artMajorStu.setName("ArtMajor major student 002");

artMajorStu.setWorkScore(rand.nextInt(101));

artMajorStu.setPrensentationScore(rand.nextInt(101));

artMajorStu.setSex('M');

students[1] = artMajorStu;

//student 003

ComputerMajor computerMajorStu = new ComputerMajor();

createStudent(rand, artMajorStu);

computerMajorStu.setName("ComputerMajor major student 003");

computerMajorStu.setOperationScore(rand.nextInt(101));

computerMajorStu.setSex('M');

students[2] = artMajorStu;

//student 001

Student student = new ComputerMajor();

createStudent(rand, artMajorStu);

student.setName("student 0013");

student.setSex('F');

students[3] = artMajorStu;

//

artMajorStu = new ArtMajor();

createStudent(rand, artMajorStu);

artMajorStu.setName("ArtMajor major student 004");

artMajorStu.setWorkScore(rand.nextInt(101));

artMajorStu.setPrensentationScore(rand.nextInt(101));

artMajorStu.setAge('F');

students[4] = artMajorStu;

for(int i = 0; i students.length; i++){

System.out.println(students[i].toString());

}

}

private static void createStudent(Random rand, Student stu) {

stu.setId(rand.nextInt(200));

stu.setTermEndScore(rand.nextInt(101));

stu.setTermMilldleScore(rand.nextInt(101));

stu.setAge(rand.nextInt(100));

}

}

abstract class Student{

protected int id;

protected String name;

protected char sex;

protected int age;

protected int termEndScore;

protected int termMilldleScore;

protected int totalScore;

public int getAge() {

return age;

}

public void setAge(int age) {

this.age = age;

}

public char getSex() {

return sex;

}

public void setSex(char sex) {

this.sex = sex;

}

public int getId() {

return id;

}

public void setId(int id) {

this.id = id;

}

public String getName() {

return name;

}

public void setName(String name) {

this.name = name;

}

public int getTermEndScore() {

return termEndScore;

}

public void setTermEndScore(int termEndScore) {

this.termEndScore = termEndScore;

}

public int getTermMilldleScore() {

return termMilldleScore;

}

public void setTermMilldleScore(int termMilldleScore) {

this.termMilldleScore = termMilldleScore;

}

public void setTotalScore(int totalScore) {

this.totalScore = totalScore;

}

public abstract int getTotalScore();

public String toString(){

return "学号:" + id + " 姓名:" + name + " 性别: " + sex+ " 年龄: " + age + " 综合成绩: " + getTotalScore();

}

}

class EnglishMajor extends Student{

private int presentationScore;

public int getTotalScore() {

return (int) (presentationScore * 0.5 + termEndScore * 0.25 + termMilldleScore*0.25);

}

public int getPresentationScore() {

return presentationScore;

}

public void setPresentationScore(int presentationScore) {

this.presentationScore = presentationScore;

}

}

class ComputerMajor extends Student{

private int operationScore;

private int englishScore;

public int getTotalScore() {

return (int) (operationScore * 0.4 + operationScore*0.2 + termEndScore * 0.2 + termMilldleScore *0.2);

}

public int getEnglishScore() {

return englishScore;

}

public void setEnglishScore(int englishScore) {

this.englishScore = englishScore;

}

public int getOperationScore() {

return operationScore;

}

public void setOperationScore(int operationScore) {

this.operationScore = operationScore;

}

}

class ArtMajor extends Student{

private int prensentationScore;

private int workScore;

public int getTotalScore() {

return (int) (prensentationScore * 0.35 + workScore * 0.35 + termMilldleScore * 0.15 + termEndScore *0.15);

}

public int getPrensentationScore() {

return prensentationScore;

}

public void setPrensentationScore(int prensentationScore) {

this.prensentationScore = prensentationScore;

}

public int getWorkScore() {

return workScore;

}

public void setWorkScore(int workScore) {

this.workScore = workScore;

}

}

求大神帮我做个设计 用JAVA 设计和实现学生信息管理系统,提供常见学生信息管理功能

打开百度,在输入框里输入:

用JAVA 设计和实现学生信息管理系统,提供常见学生信息管理功能

然后就有很多。。

关于Java界面布局设计,学生信息管理系统,求大神指点

按照你的要求编写的Java程序如下:

import java.awt.BorderLayout;

import java.awt.Color;

import java.awt.Component;

import java.awt.FlowLayout;

import java.awt.GridLayout;

import java.awt.event.ActionEvent;

import java.awt.event.ActionListener;

import javax.swing.BorderFactory;

import javax.swing.JButton;

import javax.swing.JComboBox;

import javax.swing.JFrame;

import javax.swing.JLabel;

import javax.swing.JPanel;

import javax.swing.JScrollPane;

import javax.swing.JTable;

import javax.swing.JTextField;

import javax.swing.table.DefaultTableCellRenderer;

import javax.swing.table.DefaultTableModel;

import sun.swing.table.DefaultTableCellHeaderRenderer;

public class StudentInfoManagement extends JFrame implements ActionListener{

 JLabel jl=new JLabel("注册成功!",JLabel.LEFT);

 JLabel jl1=new JLabel("编号:");

 JLabel jl2=new JLabel("姓名:");

 JLabel jl3=new JLabel("院系:");

 JTextField jtf1=new JTextField(5);

 JTextField jtf2=new JTextField(8);

 String[] college={"计算机学院","理工学院","管理学院"};

 JComboBox jcb=new JComboBox(college);

 JButton jb1=new JButton("注册");

 JButton jb2=new JButton("注销");

 JButton jb3=new JButton("查询");

 JButton jb4=new JButton("更新");

 Object[][]data=null;

 String[]columnName={"学号","姓名","院系"};

 DefaultTableModel dtm=new DefaultTableModel(data,columnName);

 JTable jt=new JTable(dtm);

 JScrollPane jsp=new JScrollPane(jt);

 JPanel jp=new JPanel();

 JPanel jp1=new JPanel();

 JPanel jp11=new JPanel();

 JPanel jp12=new JPanel();

 JPanel jp13=new JPanel();

 JPanel jp2=new JPanel();

 StudentInfoManagement(){

  super("smsGUI");

  jb1.addActionListener(this);

  jb2.addActionListener(this);

  jb3.addActionListener(this);

  jb4.addActionListener(this);

  jp11.setLayout(new FlowLayout(FlowLayout.LEFT));

  jp11.add(jl1);jp11.add(jtf1);jp11.add(jl2);jp11.add(jtf2);

  jp12.setLayout(new FlowLayout(FlowLayout.LEFT));

  jp12.add(jl3);jp12.add(jcb);

  jp13.add(jb1);jp13.add(jb2);jp13.add(jb3);jp13.add(jb4);

  jp1.setLayout(new GridLayout(3,1));

  jp1.add(jp11);jp1.add(jp12);jp1.add(jp13);

  jp1.setBorder(BorderFactory.createEtchedBorder());

  jp2.setLayout(new BorderLayout());

  // 设置table表头居左

     DefaultTableCellHeaderRenderer thr = new DefaultTableCellHeaderRenderer();

     thr.setHorizontalAlignment(JLabel.LEFT);

     jt.getTableHeader().setDefaultRenderer(thr);

     DefaultTableCellRenderer tcr = new DefaultTableCellRenderer() {

      public Component getTableCellRendererComponent(JTable table,

        Object value, boolean isSelected, boolean hasFocus,

        int row, int column) {

       if (row % 2 == 0)

        setBackground(Color.white); //设置奇数行底色

       else if (row % 2 == 1)

        setBackground(new Color(246, 246, 246)); //设置偶数行底色

       return super.getTableCellRendererComponent(table, value,

         isSelected, hasFocus, row, column);

          }

        };

     // 设置table内容居左

  tcr.setHorizontalAlignment(JLabel.LEFT);

  jt.setDefaultRenderer(Object.class, tcr);

     jp2.add(jsp);

  jp.setLayout(null);

  jp1.setBounds(2,0, 380, 130);

  jp2.setBounds(5,140, 375, 200);

  jl.setBounds(0, 340, 400, 20);

  jp.add(jp1);jp.add(jp2);jp.add(jl);

  

  add(jp);

  setSize(400,400);

  setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

  setLocationRelativeTo(null);

  setVisible(true);

 }

 @Override

 public void actionPerformed(ActionEvent ae) {

  if(ae.getSource()==jb1){

   String[]row=new String[3];

   row[0]=jtf1.getText().trim();

   row[1]=jtf2.getText().trim();

   row[2]=(String)jcb.getSelectedItem();

   dtm.addRow(row);

  }

 }

 public static void main(String[] args) {

  new StudentInfoManagement();

 }

}

运行结果:

java学生院系的介绍就聊到这里吧,感谢你花时间阅读本站内容,更多关于java学生系统管理、java学生院系的信息别忘了在本站进行查找喔。