最近很多小伙伴都在问java开发学生信息管理系统的实现和简洁易懂,适合计算机专业学生参考,课程设计、毕业论文设计参考等这两个问题,那么本篇文章就来给大家详细解答一下,同时本文还将给你拓展Android
最近很多小伙伴都在问java开发学生信息管理系统的实现和简洁易懂,适合计算机专业学生参考,课程设计、毕业论文设计参考等这两个问题,那么本篇文章就来给大家详细解答一下,同时本文还将给你拓展Android课程设计:学生信息管理、C#_asp.net学生信息管理系统源代码 基于ASP.NET和sql server开发的简单学生信息管理系统、成绩管理系统、C#开发学生信息管理系统的项目经验总结、C语言学生信息管理系统设计与实现等相关知识,下面开始了哦!
本文目录一览:- java开发学生信息管理系统的实现(简洁易懂),适合计算机专业学生参考,课程设计、毕业论文设计参考等
- Android课程设计:学生信息管理
- C#_asp.net学生信息管理系统源代码 基于ASP.NET和sql server开发的简单学生信息管理系统、成绩管理系统
- C#开发学生信息管理系统的项目经验总结
- C语言学生信息管理系统设计与实现
java开发学生信息管理系统的实现(简洁易懂),适合计算机专业学生参考,课程设计、毕业论文设计参考等
编写一个简单的学生管理信息系统。
在oracle中设计一张学生表,以学号作为关键字。
其他学生信息有:姓名、手机号。
在进入系统时,显示如下菜单:
**************************************************
=====欢迎进入学生管理信息系统=====
1. 新增学生
2. 修改学生
3. 删除学生
4. 查询学生
5. 退出系统
请选择(1-5):
**************************************************
(1) 新增学生功能:
**************************************************
=====新增学生=====
学号:
姓名:
手机号:
保存成功!
是否继续添加(y/n):
*************************************************
(2) 修改学生功能:
**************************************************
=====修改学生=====
请输入要修改的学生学号:111
该学生信息如下:
学生学号:111
学生姓名:张三
学生手机号:13333333333
请输入新的学生信息:
学生姓名:李四
学生手机号:13333333333
保存成功!
**************************************************
(3) 删除学生功能:
**************************************************
=====删除学生=====
请输入要删除的学生学号:111
该学生信息如下:
学生学号:111
学生姓名:张三
学生手机号:13333333333
是否真的删除(y/n):y
删除成功!
**************************************************
(4) 查询学生功能
**************************************************
=====查询学生=====
学生信息如下:
学号 姓名 手机号
111 张三 13333333333
222 李四 14444444444
**************************************************
编程思路:
一、定义一个学生管理类,内有增、删、改、查4个方法。
二、在main函数中,实例化学生管理类,并根据菜单的选项分别调用4个方法。
三、使用PreparedStatement的参数赋值,示例如下:
PreparedStatementpstmt = con.prepareStatement("insert into book values(?, ?, ?)");
pstmt.setString(1, "333");
pstmt.setString(2, "王五");
pstmt.setString(3, "15555555555");
pstmt.executeUpdate();
(专业提供服务计算机毕业论文设计,点击本传送门)
【实现过程】
1.数据库建stu表:
2.设计一个学生实体类(Stu.java)
package Stu;
//实体类,封装学生类数据
/**
* @authorScatlett
*/
publicclassStu {
private String no; //学号
private String name; //姓名
private String phone; //手机号
//getter setter
public String getNo() {
returnno;
}
publicvoidsetNo(String no) {
this.no = no;
}
public String getName() {
returnname;
}
publicvoidsetName(String name) {
this.name = name;
}
public String getPhone() {
returnphone;
}
publicvoidsetPhone(String phone) {
this.phone = phone;
}
//无参构造函数
public Stu() {
super();
// TODO Auto-generated constructor stub
}
//有参构造函数
public Stu(String no, String name, String phone) {
super();
this.no = no;
this.name = name;
this.phone = phone;
}
}
3.创建封装一个(DBUtil.java),用于连接到Oracle数据库
package Stu;
importjava.sql.Connection;
importjava.sql.DriverManager;
importjava.sql.ResultSet;
importjava.sql.SQLException;
importjava.sql.Statement;
publicclassDBUtil {
privatestaticfinal String DRIVER_NAME = "oracle.jdbc.driver.OracleDriver";
privatestaticfinal String URL = "jdbc:oracle:thin:@localhost:1521:orcl";
privatestaticfinal String USER = "scott";
privatestaticfinal String PASS = "tiger";
publicstatic Connection getCon() throwsClassNotFoundException,
SQLException {
Connection con = null;
Class.forName(DRIVER_NAME);
con = DriverManager.getConnection(URL, USER, PASS);
return con;
}
publicstaticvoid close(Connection con, Statement stmt, ResultSetrs) {
try {
if (rs != null) {
rs.close();
}
if (stmt != null) {
stmt.close();
}
if (con != null) {
con.close();
}
} catch (SQLException e) {
e.printStackTrace();
}
}
}
4.创建一个学生管理数据访问对象(StuDao.java)
packagestudao;
//学生管理数据访问对象StuDao
importjava.sql.Connection;
importjava.sql.PreparedStatement;
importjava.sql.ResultSet;
importjava.sql.SQLException;
importjava.util.ArrayList;
importjava.util.List;
importStu.DBUtil;
importStu.Stu;
publicclassStuDao {
private Connection con;
privatePreparedStatementpstmt;
privateResultSetrs;
//添加学生信息
publicboolean add(Stu stu) {
String sql="insert into stu(stu_no,stu_name,phone) values(?,?,?)";
try {
con=DBUtil.getCon();
pstmt=con.prepareStatement(sql);
pstmt.setString(1, stu.getNo());
pstmt.setString(2, stu.getName());
pstmt.setString(3, stu.getPhone());
pstmt.executeUpdate();
} catch (ClassNotFoundException e) {
e.printStackTrace();
returnfalse;
} catch (SQLException e) {
e.printStackTrace();
returnfalse;
} finally{
DBUtil.close(con, pstmt, rs);
}
returntrue;
}
//查看学生列表(1所有)
public List<Stu> list() {
List<Stu> list=newArrayList<Stu>();//是线性列表,ArrayList是
String sql="select * from stu";
try {
con=DBUtil.getCon();
pstmt=con.prepareStatement(sql);
//pstmt.executeUpdate();//用于增删改
rs=pstmt.executeQuery();//用于查询
while (rs.next()) {
//Stustu=new Stu(rs.getString("stu_no"),rs.getString("stu_name"),rs.getString("phone"));
//上行写法亦可为:
Stu stu=new Stu();
stu.setNo(rs.getString("stu_no"));//取结果集里面学号这一列的值赋给
stu.setName(rs.getString("stu_name"));
stu.setPhone(rs.getString("phone"));
list.add(stu);
}
} catch (ClassNotFoundException e) {
e.printStackTrace();
} catch (SQLException e) {
e.printStackTrace();
} finally{
DBUtil.close(con, pstmt, rs);
}
return list;
}
//查看学生列表(2根据学生学号显示学生信息)
public Stu findSomeone(String no) {
Stu stu=null;
String sql="select * from stu where stu_no=?";
try {
con=DBUtil.getCon();
pstmt=con.prepareStatement(sql);
//pstmt.executeUpdate();//用于增删改
pstmt.setString(1,no);
rs=pstmt.executeQuery();//用于查询
while (rs.next()) {
//Stustu=new Stu(rs.getString("stu_no"),rs.getString("stu_name"),rs.getString("phone"));
//上行写法亦可为:
stu=new Stu();
stu.setNo(rs.getString("stu_no"));//取结果集里面学号这一列的值赋给
stu.setName(rs.getString("stu_name"));
stu.setPhone(rs.getString("phone"));
}
} catch (ClassNotFoundException e) {
e.printStackTrace();
} catch (SQLException e) {
e.printStackTrace();
} finally{
DBUtil.close(con, pstmt, rs);
}
returnstu;
}
//修改学生信息
publicboolean update(Stu stu) {
String sql="update stu set stu_name=?,phone=? wherestu_no=?";
try {
con=DBUtil.getCon();
pstmt=con.prepareStatement(sql);
pstmt.setString(3, stu.getNo());
pstmt.setString(1, stu.getName());
pstmt.setString(2, stu.getPhone());
pstmt.executeUpdate();
} catch (ClassNotFoundException e) {
e.printStackTrace();
returnfalse;
} catch (SQLException e) {
e.printStackTrace();
returnfalse;
} finally{
DBUtil.close(con, pstmt, rs);
}
returntrue;
}
//删除学生信息
publicboolean del(String id) {
String sql="delete from stu where stu_no=?";
try {
con=DBUtil.getCon();
pstmt=con.prepareStatement(sql);
pstmt.setString(1,id);
pstmt.executeUpdate();
} catch (ClassNotFoundException e) {
e.printStackTrace();
returnfalse;
} catch (SQLException e) {
e.printStackTrace();
returnfalse;
} finally{
DBUtil.close(con, pstmt, rs);
}
returntrue;
}
}
5.学生信息管理系统的菜单选择实现
package Stu;
//学生信息管理系统的菜单选择
importjava.sql.Connection;
importjava.util.List;
importjava.util.Scanner;
importjavax.print.DocFlavor.INPUT_STREAM;
importorg.omg.CORBA.PUBLIC_MEMBER;
importstudao.StuDao;
publicclassStuManage {
publicvoid menu() {
//1.打印菜单
//2.输入菜单
//3.switch菜单选择
int choose;
do {
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("请选择(1-5):");
Scanner scanner=new Scanner(System.in);
choose=scanner.nextInt();
System.out.println("******************************");
switch (choose) {
case 1:
myAdd(); //菜单选择1,是新增学生
break;
case 2:
myUpdate(); //菜单选择2,是修改学生
break;
case 3:
myDel(); //菜单选择3,是删除学生
break;
case 4:
myList(); //菜单选择4,是查询学生
break;
case 5: //菜单选择5,是退出该系统
System.out.println("您选择了退出系统,确定要退出吗?(y/n)");
Scanner scan=new Scanner(System.in);
String scanExit=scan.next();
if(scanExit.equals("y")){
System.exit(-1);
System.out.println("您已成功退出系统,欢迎您再次使用!");
}
break;
default:
break;
}
} while (choose!=5);
}
//新增学生信息
publicvoidmyAdd() {
String continute;
do {
Scanner s=new Scanner(System.in);
String no,name,phone;
System.out.println("====新增学生====");
System.out.println("学号:");
no=s.next();
System.out.println("姓名:");
name=s.next();
System.out.println("手机号:");
phone=s.next();
Stu stu=new Stu(no,name,phone);
StuDaodao=newStuDao();
boolean ok=dao.add(stu);
if (ok) {
System.out.println("保存成功!");
}else {
System.out.println("保存失败!");
}
System.out.println("是否继续添加(y/n):");
Scanner scanner2=new Scanner(System.in);
continute=scanner2.next();
} while (continute.equals("y"));
}
//删除学生信息
publicvoidmyDel(){
Scanner s=new Scanner(System.in);
String no;
System.out.println("====删除学生====");
System.out.println("请输入要删除的学生学号:");
no=s.next();
System.out.println("该学生的信息如下:");
StuDaostuDao=newStuDao();
System.out.println("学生学号:"+stuDao.findSomeone(no).getNo());
System.out.println("学生姓名:"+stuDao.findSomeone(no).getName());
System.out.println("学生手机号:"+stuDao.findSomeone(no).getPhone());
System.out.println("是否真的删除(y/n):");
Scanner scanner3=new Scanner(System.in);
String x=scanner3.next();
if (x.equals("y")) {
Stu stu=new Stu(no,null,null);
StuDaodao=newStuDao();
boolean ok=dao.del(no);
if (ok) {
System.out.println("删除成功!");
}else {
System.out.println("删除失败!");
}
}
}
//修改学生信息
publicvoidmyUpdate(){
Scanner s=new Scanner(System.in);
String no;
System.out.println("====修改学生====");
System.out.println("请输入要修改的学生学号:");
no=s.next();
System.out.println("该学生的信息如下:");
StuDaostuDao=newStuDao();
System.out.println("学生学号:"+stuDao.findSomeone(no).getNo());
System.out.println("学生姓名:"+stuDao.findSomeone(no).getName());
System.out.println("学生手机号:"+stuDao.findSomeone(no).getPhone());
System.out.println("请输入新的学生信息:");
Scanner stuUp=new Scanner(System.in);
String name,phone;
System.out.println("学生姓名:");
name=stuUp.next();
System.out.println("学生手机号:");
phone=stuUp.next();
Stu stu=new Stu(no,name,phone);
StuDaodao=newStuDao();
boolean ok=dao.update(stu);
if (ok) {
System.out.println("保存成功!");
}else {
System.out.println("保存失败!");
}
}
//查询学生信息
publicvoidmyList(){
System.out.println("************************");
System.out.println("====查询学生====");
System.out.println("该学生的信息如下:");
System.out.println("学号\t姓名\t手机号");
StuDaostuDao=newStuDao();
List<Stu> list=stuDao.list();
for (Stu stuList:list) { //循环打印出查询结果
System.out.println(stuList.getNo()+"\t"+stuList.getName()+"\t"+stuList.getPhone());
}
System.out.println("************************");
}
}
6.最后编写一个主函数测试类
package Stu;
//主函数测试类
publicclass Main {
/**
* @paramargs
*/
publicstaticvoid main(String[] args) {
StuManage s=newStuManage();
s.menu();
}
}
7.程序测试结果截图:
(1) 新增学生信息
(2) 修改学生信息
(3) 删除学生信息
(4) 查询学生信息
Android课程设计:学生信息管理
一.需求分析
随着时代的进步,学生越来越多对于学生信息的管理也不断的在增加,需要能够一个能够管理学生信息的程序。
总体能够实现对学生基本信息包括:姓名、年龄、性别的记录,并且能够记录学生的选课情况,成绩,并且对成绩进行修改记录。
一.系统总体设计
技术说明
UI设计:通过多种布局的嵌套及控件的使用来达成效果,通过TextView控件显示文本信息,使用Button控件定义onClick属性并在Activity中定义方法实现点击,并且通过RadioButton在学生性别中判断,使用了Edit Text编辑框在登陆界面中,显示输入框中信息。
Activity组件的应用:主要通过使用Intent、Bundle类来进行跳转,各个Activity界面之间的切换。
SQLite数据库:创建了SQLite数据库,使用了onCreate()方法和onUpgrade()方法,并进行增删改查操作。
File存储:使用了openFileInput()和openFileOutput()方法来存取以及读取设备上的数据,也采用了一些Shared Preferences类进行储存。
ListView:使用了List View和自定义适配器,点击ListView中的条目出现对话框进行修改,修改后立即通知适配器进行数据的重新加载
一.数据库设计
字段名 |
字段类型 |
约束控制 |
说明 |
name |
char |
主键(primary key) |
姓名 |
gender |
char |
Not null |
性别 |
age |
int |
Not null |
年龄 |
class |
char |
Not null |
课程 |
grade |
int |
Not null |
分数 |
二.系统总体实现
主要部分代码:
(一)布局文件部分代码:主要展示几个比较重要的界面
1.总体文件布局
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".MainActivity" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="center"
android:orientation="vertical" >
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/main_welcome"
android:textSize="20sp" />
<Button
android:id="@+id/btn_user_manager"
android:layout_width="fill_parent"
android:layout_height="50dp"
android:layout_marginTop="23dp"
android:background="@drawable/btn_selector"
android:text="1.用户管理" />
<Button
android:id="@+id/btn_stu_manager"
android:layout_width="fill_parent"
android:layout_height="50dp"
android:layout_marginTop="23dp"
android:background="@drawable/btn_selector"
android:text="2.学生管理" />
<Button
android:id="@+id/btn_coure_manager"
android:layout_width="fill_parent"
android:layout_height="50dp"
android:layout_marginTop="23dp"
android:background="@drawable/btn_selector"
android:text="3.课程管理" />
<Button
android:id="@+id/btn_score_manager"
android:layout_width="fill_parent"
android:layout_height="50dp"
android:layout_marginTop="23dp"
android:background="@drawable/btn_selector"
android:text="4.成绩管理" />
<Button
android:id="@+id/btn_exit"
android:layout_width="fill_parent"
android:layout_height="50dp"
android:layout_marginTop="23dp"
android:background="@drawable/btn_selector"
android:text="5.退出" />
</LinearLayout>
</RelativeLayout>
- 登录界面
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="50dip"
android:orientation="vertical" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:text="用户登录"
android:textColor="@color/black"
android:textSize="23sp" />
</RelativeLayout>
<!-- 信息输入框 -->
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10.0dip"
android:layout_marginRight="10.0dip"
android:layout_marginTop="20.0dip"
android:orientation="vertical" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="50.0dip"
android:gravity="center_vertical"
android:orientation="horizontal" >
<TextView
android:layout_width="wrap_content"
android:layout_height="50.0dip"
android:gravity="center_vertical"
android:text="用户名:"
android:textSize="20sp" />
<EditText
android:id="@+id/loginInputUserName"
android:layout_width="fill_parent"
android:layout_height="50.0dip"
android:hint="请输入用户名" />
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="50.0dip"
android:gravity="center_vertical"
android:orientation="horizontal" >
<TextView
android:layout_width="wrap_content"
android:layout_height="50.0dip"
android:gravity="center_vertical"
android:text="密 码:"
android:textSize="20sp" />
<EditText
android:id="@+id/loginInputPassword"
android:layout_width="fill_parent"
android:layout_height="50.0dip"
android:hint="请输入密码" />
</LinearLayout>
</LinearLayout>
<Button
android:id="@+id/btn_login"
android:layout_width="200dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="20dp"
android:text="登录" />
</LinearLayout>
- 展现学生信息界面
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="80dp"
android:padding="8dp" >
<LinearLayout
android:id="@+id/linearLayout1"
android:layout_width="fill_parent"
android:layout_height="80dp"
android:orientation="vertical" >
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="40dp" >
<TextView
android:layout_width="40dp"
android:layout_height="40dp"
android:text="姓名"
android:textSize="20sp" />
<View
android:layout_width="wrap_content"
android:layout_height="1dp"
android:layout_weight="1" />
<TextView
android:layout_width="40dp"
android:layout_height="40dp"
android:text="性别"
android:textSize="20sp" />
<View
android:layout_width="wrap_content"
android:layout_height="1dp"
android:layout_weight="1" />
<TextView
android:layout_width="40dp"
android:layout_height="40dp"
android:text="年龄"
android:textSize="20sp" />
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="40dp" >
<TextView
android:id="@+id/tv_name"
android:layout_width="wrap_content"
android:layout_height="50dp"
android:text=""
android:textSize="20sp" />
<View
android:layout_width="wrap_content"
android:layout_height="1dp"
android:layout_weight="1" />
<TextView
android:id="@+id/tv_sex"
android:layout_width="wrap_content"
android:layout_height="50dp"
android:text=""
android:textSize="20sp" />
<View
android:layout_width="wrap_content"
android:layout_height="1dp"
android:layout_weight="1" />
<TextView
android:id="@+id/tv_age"
android:layout_width="wrap_content"
android:layout_height="40dp"
android:text=""
android:textSize="20sp" />
</LinearLayout>
</LinearLayout>
</RelativeLayout>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="20dp" >
<ListView
android:id="@+id/course_student_manage"
android:layout_width="match_parent"
android:layout_height="match_parent" >
</ListView>
</LinearLayout>
(二)Activity代码(部分)
- MainActivity
package com.example.studentsytem;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import com.example.CourseManagerActivity;
import com.example.ScoreManagerActivity;
import com.example.StudentManagerActivity;
import com.example.UserManagerActivity;
import com.example.StudentDBHelper;
public class MainActivity extends Activity implements OnClickListener {
private Button btn_user_manager;
private Button btn_stu_manager;
private Button btn_coure_manager;
private Button btn_score_manager;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
btn_user_manager = (Button) this.findViewById(R.id.btn_user_manager);
btn_stu_manager = (Button) this.findViewById(R.id.btn_stu_manager);
btn_coure_manager = (Button) this.findViewById(R.id.btn_coure_manager);
btn_score_manager = (Button) this.findViewById(R.id.btn_score_manager);
btn_user_manager.setOnClickListener(this);
btn_stu_manager.setOnClickListener(this);
btn_coure_manager.setOnClickListener(this);
btn_score_manager.setOnClickListener(this);
}
public void onClick(View v) {
switch (v.getId()) {
case R.id.btn_user_manager:
Intent intent1 = new Intent(MainActivity.this, UserManagerActivity.class);
startActivity(intent1);
break;
case R.id.btn_stu_manager:
Intent intent2 = new Intent(MainActivity.this, StudentManagerActivity.class);
startActivity(intent2);
break;
case R.id.btn_coure_manager:
Intent intent3 = new Intent(MainActivity.this, CourseManagerActivity.class);
startActivity(intent3);
break;
case R.id.btn_score_manager:
Intent intent4 = new Intent(MainActivity.this, ScoreManagerActivity.class);
startActivity(intent4);
break;
case R.id.btn_exit:
break;
}
}
}
- StudentManagerActivity
package com.example.studentsytem;
import java.util.ArrayList;
import java.util.List;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
public class StudentManagerActivity extends Activity implements OnClickListener{
private Button query_by_name;
private Button query_all_student;
private EditText et_query_by_name;
private Button btn_query_by_name;
private Button score_student;
private List<Student> list;
private TextView tv_name;
private TextView tv_sex;
private TextView tv_age;
private View dialogView;
private AlertDialog dialog;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.student_manage);
list = new ArrayList<Student>();
query_by_name = (Button) this.findViewById(R.id.query_by_name);
query_all_student = (Button) this.findViewById(R.id.query_all_student);
score_student = (Button) this.findViewById(R.id.score_student);
query_by_name.setOnClickListener(this);
query_all_student.setOnClickListener(this);
score_student.setOnClickListener(this);
}
public void onClick(View v) {
switch (v.getId()) {
case R.id.query_by_name:
AlertDialog.Builder builder = new AlertDialog.Builder(this);
//加载布局文件
LayoutInflater inflater = (LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
dialogView = inflater.inflate(R.layout.dialog_query_by_name,null);
builder.setView(dialogView);
builder.create();
dialog = builder.show();
et_query_by_name = (EditText) dialogView.findViewById(R.id.et_query_by_name);
btn_query_by_name = (Button) dialogView.findViewById(R.id.btn_query_by_name);
tv_name = (TextView) dialogView.findViewById(R.id.tv_name);
tv_sex = (TextView) dialogView.findViewById(R.id.tv_sex);
tv_age = (TextView) dialogView.findViewById(R.id.tv_age);
//点击按钮的时候对学生信息进行查询
btn_query_by_name.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
String name = et_query_by_name.getText().toString();
//查询学生信息
queryStudentByName(name);
}
});
break;
case R.id.query_all_student://查询所有学生信息
Intent intent = new Intent(StudentManagerActivity.this, QueryAllStudentActivity.class);
startActivity(intent);
finish();
break;
case R.id.score_student: //管理学生分数信息
Intent intent2 = new Intent(StudentManagerActivity.this, ManageStudentScoreActivity.class);
startActivity(intent2);
finish();
break;
}
}
/**
* 根据姓名查询学生信息
*
*
*/
protected void queryStudentByName(String name) {
PersonFactory factory = new PersonFactory();
TeacherInter teacherInter = (TeacherInter) factory.getPersonByClass("com.xuliugen.control.impl.TeacherImpl");
list = teacherInter.queryStudentByName(name);
if (list != null) {
for (Student stu : list) {
// 如果一下子赋值的话是不正确的
tv_name.setText(stu.getName() + "");
tv_sex.setText(stu.getSex() + "");
tv_age.setText(stu.getAge() + "");
}
} else {
// dialog.dismiss(); //这句话是消掉dialog之后弹出一个对话框
Toast.makeText(StudentManagerActivity.this, "没有找到你所需要的学生信息!",Toast.LENGTH_LONG).show();
}
}
}
3.StudentDBHelper
package com.example.studentsytem;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteDatabase.CursorFactory;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;
public class StudentDBHelper extends SQLiteOpenHelper {
private static final String TAG = "StudentDBHelper";
public static final String DB_NAME = "student_manager.db";
public static final int VERSION = 1; //构造方法
public StudentDBHelper(Context context, String name, CursorFactory factory, int version)
{
super(context, name, factory, version);
}
public StudentDBHelper(Context context) {
this(context, DB_NAME, null, VERSION); }
//创建数据库
@Override
public void onCreate(SQLiteDatabase db) {
Log.v(TAG, "onCreate");
db.execSQL("create table "
+ TableContanst.STUDENT_TABLE + "(_id Integer primary key AUTOINCREMENT,"
+ "name char,age integer, sex char, likes char, phone_number char,train_date date, "
+ "modify_time DATETIME)"); }
//更新数据库
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
Log.v(TAG, "onUpgrade");
}
}
4,UserLoginActivity
package com.example.studentsytem;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
public class UserLoginActivity extends Activity {
private EditText loginInputUserName;
private EditText loginInputPassword;
private Button btn_login;
private String username;
private String password;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.user_login);
loginInputUserName = (EditText) this.findViewById(R.id.loginInputUserName);
loginInputPassword = (EditText) this.findViewById(R.id.loginInputPassword);
btn_login = (Button) this.findViewById(R.id.btn_login);
btn_login.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
//获取值要在按钮点击的时候
username = loginInputUserName.getText().toString();
password = loginInputPassword.getText().toString();
studentLogin(username, password);
}
});
}
/**
* 用户的登录
*
*/
private void studentLogin(String username, String password) {
PersonFactory personFactory = new PersonFactory();
StudentInter studentInter = (StudentInter) personFactory.getPersonByClass("com.xuliugen.control.impl.StudentImpl");
boolean flag = studentInter.login(username,password);
if(flag){
Toast.makeText(UserLoginActivity.this, "登录成功!", Toast.LENGTH_LONG).show();
Intent intent = new Intent(UserLoginActivity.this,UserManagerActivity.class);
finish();
}else{
Toast.makeText(UserLoginActivity.this, "登录失败!", Toast.LENGTH_LONG).show();
Intent intent = new Intent(UserLoginActivity.this,UserManagerActivity.class);
finish();
}
}
}
五.程序功能测试及截图
(1)主界面
(2)注册界面
(3)查找界面
(4)选课界面
(5)查询信息界面
六.心得体会
这次课设使我对android项目的开发有了一个新的认识,知道了一个心得项目是什么样的,完成一个项目真的很需要时间和精力。在制作的过程中总是会出现各种各样的问题,在Activity的切换上遇到问题,以及在File存储,listview出现了困难,通过上博客园、CSDN之类的学术网站去参考一些的解决办法,总之还是要多学习,多练习,经常做才能更加的熟悉。
C#_asp.net学生信息管理系统源代码 基于ASP.NET和sql server开发的简单学生信息管理系统、成绩管理系统
C#_asp.net学生信息管理系统源代码
基于ASP.NET和sql server开发的简单学生信息管理系统、成绩管理系统,实现了学生管理、课程管理、成绩管理、班级管理、教师管理、用户管理等基本增删改查功能。
YID:4123648234577288
C#开发学生信息管理系统的项目经验总结
C#开发学生信息管理系统的项目经验总结
引言:
学生信息管理系统是一个为学校、教育机构和教育管理部门提供帮助的重要工具。随着信息技术的迅猛发展,利用计算机和软件开发技术来实现学生信息管理系统成为一种趋势。本文将总结我在C#开发学生信息管理系统项目中的经验和教训,希望对其他开发人员在类似项目中有所启发。
一、项目需求分析
在开始项目开发之前,首要任务是进行需求分析。我们需要和项目的利益相关者进行充分沟通,明确他们对学生信息管理系统的期望和需求。在这个阶段,我学会了倾听并提出问题,以确保我理解客户的需求。通过使用用例图、领域模型和需求文档等实用工具,我能够精确地捕捉到项目的功能和非功能需求。
二、系统设计与架构
系统设计和架构是项目成功的关键。在学生信息管理系统开发中,我们需要考虑模块划分、数据库设计、用户交互和系统维护等方面。我意识到,在设计过程中,要注重系统的可扩展性和可维护性。通过使用面向对象编程的原则和设计模式,我们能够将系统划分成各个模块,使得系统更易于开发和维护。
三、数据库设计和管理
学生信息管理系统需要一个稳定可靠的数据库来存储学生的个人和学术信息。在数据库设计方面,我学会了使用ER图和关系模型来设计数据库结构,并使用SQL语言进行数据库操作。同时,我也认识到数据库管理的重要性,包括备份、恢复和性能优化等方面。定期备份数据库可以保证数据的安全性,而性能优化可以提高系统的响应速度。
四、用户界面设计和用户体验
用户界面是用户与学生信息管理系统进行交互的重要途径。一个好的用户界面设计可以提高用户的使用体验和工作效率。在开发过程中,我学习了使用WPF和WinForms等工具进行界面设计,尽量让界面简洁、易于使用。同时,通过用户调研和反馈,我们可以不断改进界面,提高用户的满意度。
五、测试和调试
一个好的软件开发过程需要经过充分的测试和调试阶段,学生信息管理系统也不例外。在测试过程中,我学到了编写单元测试和集成测试的技巧,并使用调试工具来定位和修复bug。同时,我还了解了自动化测试的概念和实践,通过自动化测试能够提高测试效率和准确性。
六、项目管理和团队合作
在项目开发中,项目管理和团队合作是至关重要的。学生信息管理系统项目通常需要多个开发人员和多个部门协同合作。我学会了使用项目管理工具进行项目计划、跟踪和协作。同时,我也体会到了团队合作的重要性,包括沟通、协商和共享知识等方面。通过与团队成员的有效沟通和合作,我们能够更好地实现项目目标。
结论:
通过参与C#开发学生信息管理系统的项目,我不仅学到了很多关于软件开发的技术知识和技能,更重要的是我锻炼了自己的实践能力和解决问题的能力。在今后的开发工作中,我将继续学习和应用最新的开发技术,不断提高自己的能力,为学生信息管理系统项目的成功贡献自己的力量。同样,我也鼓励其他开发者积极参与类似项目,在实践中不断成长和进步。
以上就是C#开发学生信息管理系统的项目经验总结的详细内容,更多请关注php中文网其它相关文章!
C语言学生信息管理系统设计与实现
本文实例为大家分享了C语言学生信息管理系统的具体代码,供大家参考,具体内容如下
#include"stdio.h" //标准的输入输出函数文件头部说明 #include"math.h" // 数学函数头部说明 #include"string.h" #include"stdlib.h" //通过该函数头部里的函数,改变控制台的背景和颜色 #include"windows.h" //头文件声明,下文用到了改变控制台的宽度和高度 #define M 100 //宏定义说明 struct student{ //结构体定义并声明 char name[25]; //姓名 char num[25]; //学号 char credit[20]; //身份证号 char native[35]; //籍贯 char tel[25]; //手机号 int special; //专业 int banji; //班级 int math,yy,wl,cyy,pe; //数学、英语、物理、C语言、体育 double ave;}; //平均分 //****************************************函数的声明******************************************** void input(struct student stu[M]); //输入函数 void output(struct student stu[M]); //各类用户自定义函数的声明 void lookfor(struct student stu[M]); //查询函数 void modify(struct student stu[M]); //修改函数 void order(struct student stu[M]); //排序函数 void delete_student(struct student stu[M]); //删除函数 void xuehao(struct student stu[M]); void xingming(struct student stu[M]); void fileread(struct student stu[M]); void filewrite(struct student stu[M]); void yanshi(char *p); //延时函数说明 //********************************************************************************************** int count=0; struct student t; int main() { int choice,sum; struct student stu[M]; system("mode con:cols=400 lines=30000"); //调节控制台的宽度和高度 system("color 0b"); //调节控制台的背景和字体颜色 point1: sum=0; yanshi("\t\t\t\t\t\t\t\t\3\3\3\3\3\3\3\3\3\3\3\3\3欢迎你使用学生信息管理系统\3\3\3\3\3\3\3\3\3\3\n"); do { printf("\t\t\t\t\t\t\t\t-------------------------------------------------\n"); printf("\t\t\t\t\t\t\t\t+ 学生信息管理系统 +\n"); printf("\t\t\t\t\t\t\t\t-------------------------------------------------\n"); printf("\t\t\t\t\t\t\t\t\t\t ***************\n"); printf("\t\t\t\t\t\t\t\t\t\t 1、添加学生信息\n"); printf("\t\t\t\t\t\t\t\t\t\t 2、浏览学生信息\n"); printf("\t\t\t\t\t\t\t\t\t\t 3、查询学生信息\n"); printf("\t\t\t\t\t\t\t\t\t\t 4、修改学生信息\n"); printf("\t\t\t\t\t\t\t\t\t\t 5、删除学生信息\n"); printf("\t\t\t\t\t\t\t\t\t\t 6、排列学生信息\n"); printf("\t\t\t\t\t\t\t\t\t\t 7、读取文件学生\n"); //从文件读取 printf("\t\t\t\t\t\t\t\t\t\t 8、保存到文件\n"); //保存到文件 printf("\t\t\t\t\t\t\t\t\t\t 9、退出系统\n"); printf("\t\t\t\t\t\t\t\t\t\t ***************\n"); printf("请输入你的选择\n"); scanf("%d",&choice); fflush(stdin); //清除输入缓冲区 if (choice>9||choice<=0) { sum++; if (sum>=5) { printf("输入错误次数过多,程序将重新开始\n"); system("pause"); //程序暂停 system("cls"); //清屏语句 goto point1; } } switch (choice) //根据选择,调用不同的函数来完成不同的任务 { case 1:input(stu);break; case 2:output(stu);break; case 3:lookfor(stu);break; case 4:modify(stu);break; case 5:delete_student(stu);break; case 6:order(stu);break; case 7:fileread(stu);break; case 8:filewrite(stu);;break; case 9:printf("感谢你使用学生信息管理系统,请关掉程序!!!\n");system("pause");break; default:printf("无效的选择!!!请重新输入!!!\n");break; } }while (choice!=9); printf("the program is over!!!\n"); return 0; } void input(struct student stu[M]) //自定义输入函数 { int len,size; system("cls"); printf("请添加要输入学生的信息\n"); do { printf("请输入由11位数字组成的学生学号\n"); //do-while循环应用,提示输入位数为一确定数 scanf("%s",&stu[count].num); len=strlen(stu[count].num); }while(len!=11); printf("请输入同学的姓名\n"); scanf("%s",stu[count].name); do { printf("请输入由18位数字组成的学生身份证号\n"); //同上 scanf("%s",&stu[count].credit); size=strlen(stu[count].credit); }while(size!=18); printf("请输入学生的籍贯\n"); scanf("%s",&stu[count].native); printf("请输入学生的手机号码\n"); scanf("%s",&stu[count].tel); printf("请输入所需要的专业代号:1、计算机科学 2、通信工程 3、网络工程\n"); //采用如此方法解决了专业输入难问题 scanf("%d",&stu[count].special); printf("请输入对应的学生班级号码:1、1301 2、1302 \n"); scanf("%d",&stu[count].banji); do { printf("请依次输入不大于100的学生各科成绩\n"); scanf("%d%d%d%d%d",&stu[count].math,&stu[count].yy,&stu[count].wl,&stu[count].cyy,&stu[count].pe); }while(stu[count].math>100||stu[count].yy>100||stu[count].wl>100||stu[count].cyy>100||stu[count].pe>100); //同上同上 stu[count].ave=(stu[count].math+stu[count].yy+stu[count].wl+stu[count].cyy+stu[count].pe)/5.0; //求出平均值 count++; } void output(struct student stu[M]) //自定义输出函数 { int j; system("cls"); if (count==0) { printf("当前已存学生信息为0个\n"); return; } for (j=0;j<count;j++) { printf("学号\t\t 姓名\t\t身份证号\t籍贯\t手机号\t\t专业\t\t班级\t数学\t英语\t物理\tC语言\t体育\t平均分\n"); for (j=0;j<count;j++){ //for循环控制输出的个数 printf("%s\t",stu[j].num); printf("%s\t",stu[j].name); printf("%s\t",stu[j].credit); printf("%s\t",stu[j].native); printf("%s\t",stu[j].tel); if (stu[j].special==1) printf("计算机科学\t"); else if (stu[j].special==2) printf("通信工程\t"); else printf("网络工程\t"); printf("%d\t",stu[j].banji); printf("%d\t",stu[j].math); printf("%d\t",stu[j].yy); printf("%d\t",stu[j].wl); printf("%d\t",stu[j].cyy); printf("%d\t",stu[j].pe); printf("%.1lf\t\n",stu[j].ave);} } } void lookfor(struct student stu[M]) //自定义查询学生信息函数 { int j,flag=0; char xh[25]; system("cls"); if (count==0) { printf("当前已存学生信息为0个,无法查询!!!\n"); return; } else { printf("请输入你想要查看的同学学号\n"); scanf("%s",&xh); fflush(stdin); for (j=0;j<count;j++) { if (strcmp(stu[j].num,xh)==0) //通过字符函数对已存入的学生信息进行比较,找出要查看的学生 { printf("学号\t\t姓名\t\t身份证号\t籍贯\t手机号\t\t专业\t\t班级\t数学\t英语\t物理\tC语言\t体育\t平均分\n"); printf("%s\t",stu[j].tel); if (stu[j].special==1) printf("计算机科学\t"); else if (stu[j].special==2) printf("通信工程\t"); else printf("网络工程\t"); printf("%d\t",stu[j].banji); //考虑一个对齐的因数 printf("%d\t",stu[j].pe); printf("%.1lf\t",stu[j].ave); } } if (j==count) printf("很抱歉,没有你所需要的学生信息\n"); } } void modify(struct student stu[M]) //自定义修改函数 { int j,flag=0,course; char xh[25]; system("cls"); if (count==0) { printf("当前已存学生信息为0个,无法修改!!!\n"); return; } else { printf("请输入你想要修改的同学学号\n"); scanf("%s",&xh); fflush(stdin); for (j=0;j<count;j++) if (strcmp(stu[j].num,xh)==0) //同上 { printf("你确定要修改学生的信息吗???如果不确定的话,请关掉本程序吧!!!\n"); printf("选择课程: 1、数学 2、英语 3、物理 4、C语言 5、体育\n"); scanf("%d",&course); printf("请输入你想要修改后的学生成绩\n"); switch(course) { case 1:scanf("%d",&stu[j].math);break; case 2:scanf("%d",&stu[j].yy);break; //switch控制语句 case 3:scanf("%d",&stu[j].wl);break; case 4:scanf("%d",&stu[j].cyy);break; case 5:scanf("%d",&stu[j].pe);break; default:printf("无效的选择!!!请重新输入!!!\n");break; } } } } void delete_student(struct student stu[M]) //自定义删除函数 { int choice; system("cls"); if (count==0) { printf("当前已存学生信息为0个,无法删除!!!\n"); return; } else { printf("请选择你所要删除的方式:1、学号 2、姓名(如果你的姓名是中文,那么无法删除,请选择学号删除) 3、取消\n"); scanf("%d",&choice); switch(choice) //switch语句对用户要删除的方式进行选择 { case 3:return;break; case 2:xingming(stu);break; //用户自定义函数之间的套用 case 1:xuehao(stu);break; default:printf("无效的选择!!!请重新输入!!!\n");break; } } } void order(struct student stu[M]) //排序函数的定义 { int j,k,choice,index; system("cls"); printf("请输入你想要进行排序的方式(所有排序的方式均是降序)!!!\n"); printf("1、数学 2、英语 3、物理 4、C语言 5、体育 6、平均分\n"); scanf("%d",&choice); switch (choice) { case 1:for (j=0;j<count;j++) { index=j; for (k=j+1;k<count;k++) if (stu[k].math>stu[index].math) {t=stu[k];stu[k]=stu[index];stu[index]=t;} };break; case 2:for (j=0;j<count;j++) { index=j; for (k=j+1;k<count;k++) if (stu[k].yy>stu[index].yy) {stu[k]=stu[index];} //整个为排序部分,采用了所谓的选择排序的方法 };break; case 3:for (j=0;j<count;j++) { index=j; for (k=j+1;k<count;k++) if (stu[k].wl>stu[index].wl) {t=stu[k];stu[k]=stu[index];stu[index]=t;} };break; case 4:for (j=0;j<count;j++) { index=j; for (k=j+1;k<count;k++) if (stu[k].cyy>stu[index].cyy) {t=stu[k];stu[k]=stu[index];stu[index]=t;} };break; case 5:for (j=0;j<count;j++) { index=j; for (k=j+1;k<count;k++) if (stu[k].pe>stu[index].pe) {t=stu[k];stu[k]=stu[index];stu[index]=t;} };break; case 6:for (j=0;j<count;j++) { index=j; for (k=j+1;k<count;k++) if (stu[k].ave>stu[index].ave) {t=stu[k];stu[k]=stu[index];stu[index]=t;} //强制类型转换符号只能用于有操作数,根据赋值运算中的类型转换问题可知 };break; default:printf("无效的选择!!!请重新输入!!!\n");break; } } void xuehao(struct student stu[M]) //自定义通过学号方式删除学生信息函数 { int j,index=0,k=count; char xh[25]; system("cls"); printf("请输入你想要删除的同学学号\n"); scanf("%s",xh); fflush(stdin); for (j=0;j<count;j++) { if (strcmp(stu[j].num,xh)==0) { for (j=index;j<count;j++) stu[j]=stu[j+1]; count--; if (count<k) printf("你已经删除成功\n"); } index++;} if (j==count) printf("抱歉!!!没有你所需要删除的学生信息!*_*!\n"); } void xingming(struct student stu[M]) //自定义通过姓名方式删除学生信息函数 { int flag=0,j,k=count; char xm[25]; system("cls"); printf("请输入你想要删除的同学姓名\n"); scanf("%s",xm); fflush(stdin); for (j=0;j<count;j++) { if (strcmp(stu[j].num,xm)==0) { for (j=flag-1;j<count;j++) stu[j]=stu[j+1]; count--; if (count<k) printf("你已经删除成功\n"); } flag++;} if (j==count) printf("抱歉!!!没有你所需要删除的学生信息!*_*!\n"); } void yanshi(char *p) //延时函数的定义 { while (1) { if (*p!=0) printf("%c",*p++); else break; Sleep(100); //延时控制间断语句 } } void filewrite(struct student stu[M]) //写入文件函数定义 { int j=0; char c; FILE *fp; printf("请选择是否要存入已输入的学生信息:'y'还是'n'???\n"); scanf("%c",&c); fflush(stdin); while(c!='y'&&c!='n'){ if (c!='y'&&c!='n') printf("输入错误,请重新输入\n"); printf("以下操作将会覆盖已存储的数据,确定请输入'y'或'n'???\n"); scanf("%c",&c); fflush(stdin); } if (c=='y') { if((fp=fopen("d:\\stu.dat","wb"))==NULL) { printf("文件打开错误,程序无法进行\n"); exit(0); } for(j=0;j<count;j++) {fwrite(&stu[j],sizeof(struct student),1,fp); } fclose(fp); if(count==0) printf("没有文件,无法保存\n"); else printf("数据存储完毕\n"); system("pause"); } else return; } void fileread(struct student stu[M]) //读取文件信息函数定义 { int j=0; char c; FILE *fp; system("cls"); printf("请选择是否要存入已输入的学生信息:'y'还是'n'???\n"); scanf("%c","rb"))==NULL) { printf("文件打开错误,程序无法进行\n"); exit(0); } fread(&stu[j],fp); count=0; count++; j++; while(fread(&stu[j],fp)) { j++; count++; } fclose(fp); printf("数据读取完毕!!!\n"); system("pause"); } else return; }
更多学习资料请关注专题《管理系统开发》。
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持编程小技巧。
您可能感兴趣的文章:
- 基于C语言实现学生成绩管理系统
- C语言版学生成绩管理系统
- C语言数组实现学生信息管理系统设计
- C语言学生信息管理系统小项目
- C语言实现学生信息管理系统(单链表)
- C语言单链表版学生信息管理系统
- 学生信息管理系统C语言版
- C语言实现简单学生学籍管理系统
- C语言学生学籍管理系统课程设计
- C语言实现学生学籍管理系统
关于java开发学生信息管理系统的实现和简洁易懂,适合计算机专业学生参考,课程设计、毕业论文设计参考等的问题就给大家分享到这里,感谢你花时间阅读本站内容,更多关于Android课程设计:学生信息管理、C#_asp.net学生信息管理系统源代码 基于ASP.NET和sql server开发的简单学生信息管理系统、成绩管理系统、C#开发学生信息管理系统的项目经验总结、C语言学生信息管理系统设计与实现等相关知识的信息别忘了在本站进行查找喔。
本文标签: