java的学生信息管理系统_学生管理系统java

java的学生信息管理系统_学生管理系统java导读正文本文实例为大家分享了java学生信息管理系统的具体代码,实现学生信息:增加int[]a=newint[9]、删除、查找、更改,供大家参考,具体内容如下/*学生信息管理系统,实现学生信息:*增加int[]a=newint[9]*删除*查找*更改*/importjava.util.Scanner;//导入java输入流importjava.lang.*;importja…

大家好,又见面了,我是你们的朋友全栈君。如果您正在找激活码,请点击查看最新教程,关注关注公众号 “全栈程序员社区” 获取激活教程,可能之前旧版本教程已经失效.最新Idea2022.1教程亲测有效,一键激活。

Jetbrains全系列IDE使用 1年只要46元 售后保障 童叟无欺

导读

正文

本文实例为大家分享了java学生信息管理系统的具体代码,实现学生信息: 增加 int[] a=new int[9] 、删除 、查找、更改,供大家参考,具体内容如下

/*学生信息管理系统,实现学生信息:

*增加 int[] a=new int[9]

*删除

*查找

*更改

*/

import java.util.Scanner;//导入java输入流

import java.lang.*;

import java.io.*;

class Student

{

private static Student[] s=new Student[2];

int n=0;

private String name;

private int num;

private String classAge;

public void judge()throws IOException

{

int i;

char ch;

String str;

Scanner In=new Scanner(System.in);

if(n==0)

{

System.out.print(“你还没有录入任何学生,是否录入(Y/N):”);

str=In.next();

ch=str.charAt(0);

while(ch!=’Y’&&ch!=’y’&&ch!=’N’&&ch!=’n’)

{

System.out.print(“输入有误,请重新输入:”);

str=In.next();

ch=str.charAt(0);

}

if(ch==’Y’||ch==’y’)

{

this.add();

}

if(ch==’N’||ch==’n’)

{

this.menu();

}

}

}

public void menu()throws IOException//定义菜单函数

{

int a;//定义switch语句变量

Scanner in=new Scanner(System.in);//实例化输入流对象

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(“****************************************”);

System.out.print(“请选择(0~5):”);

a=in.nextInt();

while(a<0||a>5)

{

System.out.print(“输入超出范围,请重新输入:”);

a=in.nextInt();

}

switch(a)

{

case 1:this.add();break;

case 2:this.show();break;

case 3:this.modif();break;

case 4:this.delete();break;

case 5:this.look();break;

case 0:System.exit(0);break;

}

}

public void add()throws IOException//定义增加函数

{

String str,str1,str2;

int i,num1,t=1;

char ch,ch1;

FileWriter fw=new FileWriter(“F://javaFile//student.txt”,true);

fw.write(” 录入的学生信息列表\r\n\r\n学号 姓名 班级\r\n”);

Scanner In=new Scanner(System.in);

while(t==1)

{

System.out.print(“请输入学生学号:”);

num1=In.nextInt();

for(i=0;i

{

while(s[i].num==num1)

{

System.out.println(“已存在此学号,请重新输入”);

System.out.print(“请输入学号:”);

num1=In.nextInt();

}

}

s[n].num=num1;

str2=String.valueOf(num1);

fw.write(str2+” “);

System.out.println();

System.out.print(“请输入学生姓名:”);

s[n].name=In.next();

fw.write(s[n].name+” “);

System.out.println();

System.out.print(“请输入学生班级:”);

s[n].classAge=In.next();

fw.write(s[n].classAge+”\r\n”);

++n;

fw.close();

System.out.println();

System.out.print(“是否继续添加(Y/N)”);

str=In.next();

ch=str.charAt(0);

while(ch!=’N’&&ch!=’n’&&ch!=’Y’&&ch!=’y’)

{

System.out.print(“输入有误,请重新输入:”);

str=In.next();

ch=str.charAt(0);

}

if(ch==’N’||ch==’n’)

{

break;

}

}

System.out.println();

System.out.print(“是否返回主菜单(Y/N)”);

str1=In.next();

ch1=str1.charAt(0);

while(ch1!=’Y’&&ch1!=’y’&&ch1!=’N’&&ch1!=’n’)

{

System.out.print(“输入有误,请重新输入:”);

str1=In.next();

ch1=str1.charAt(0);

}

if(ch1==’Y’||ch1==’y’)

{

this.menu();

}

if(ch1==’N’||ch1==’n’)

{

System.out.println(“正在退出…谢谢使用!”);

System.exit(0);

}

}

public void show()throws IOException

{

int i;

this.judge();

System.out.println(“本次操作共录入”+n+”位学生!”);

System.out.println(“你录入的学生信息如下:”);

System.out.println();

System.out.println(“学号\t\t姓名\t班级”);

for(i=0;i

{

System.out.println(s[i].num+” “+s[i].name+” “+s[i].classAge);

}

System.out.println(“系统返回主菜单!”);

this.menu();

}

public void delete()throws IOException//删除信息功能实现 注:本功能暂时不具备可扩展性

{

this.judge();

int j=0,t=0,k=0,num1;

char ch;

String str;

Scanner pin=new Scanner(System.in);

System.out.print(“请输入要删除的学号:”);

num1=pin.nextInt();

for(j=0;j

{

if(s[j].num==num1)

{

k=1;

t=j;

}

}

if(k==0)

{

System.out.println(“对不起!你要删除的学号不存在!”);

System.out.println(“系统将返回主菜单!”);

this.menu();

}

if(k==1)

{

System.out.println(“你要删除的学生信息如下:”);//打印管理员要删除的学生信息

System.out.println(“学号\t姓名\t班级”);//本功能暂时不备扩展性

System.out.println(s[t].num+” “+s[t].name+” “+s[t].classAge);

System.out.println();

System.out.print(“你确定要删除(Y/N):”);

str=pin.next();

ch=str.charAt(0);

while(ch!=’Y’&&ch!=’y’&&ch!=’N’&&ch!=’n’)

{

System.out.print(“输入有误,请重新输入:”);

str=pin.next();

ch=str.charAt(0);

}

if(ch==’N’||ch==’n’)

{

System.out.println();

System.out.println(“系统返回主菜单!”);

this.menu();

}

if(ch==’Y’||ch==’y’)

{

for(j=t;j

{

s[j]=s[j+1];

}

n–;

System.out.println(“数据成功删除!”);

System.out.println(“系统返回主菜单!”);

this.menu();

}

}

}

public void look()throws IOException

{

FileReader fr=new FileReader(“F://javaFile//student.txt”);

int a;

while((a=fr.read())!=-1)

{

System.out.print((char)a);

}

fr.close();

System.out.println(“系统返回主菜单!”);

System.out.println();

this.menu();

}

public void modif()throws IOException

{

this.judge();

int j=0,num2,num3,moi,c=1;

char ch;

String str,str2;

Scanner pin=new Scanner(System.in);

System.out.print(“请输入要修改的学号:”);

num2=pin.nextInt();

for(j=0;j

{

if(s[j].num==num2)

{

k=1;

t=j;

}

}

if(k==0)

{

System.out.println(“对不起!你要修改的学号不存在!”);

System.out.println(“系统将返回主菜单!”);

this.menu();

}

if(k==1)

{

System.out.println(“你要修改的学生信息如下:”);//打印管理员要删除的学生信息

System.out.println(“学号\t姓名\t班级”);//本功能暂时不备扩展性

System.out.println(s[t].num+” “+s[t].name+” “+s[t].classAge);

System.out.println();

System.out.print(“你确定要修改(Y/N):”);

str=pin.next();

ch=str.charAt(0);

while(ch!=’Y’&&ch!=’y’&&ch!=’N’&&ch!=’n’)

{

System.out.print(“输入有误,请重新输入:”);

str=pin.next();

ch=str.charAt(0);

}

if(ch==’N’||ch==’n’)

{

System.out.println();

System.out.println(“系统返回主菜单!”);

this.menu();

}

while(c==1)

{

if(ch==’Y’||ch==’y’)

{

System.out.println(“****************************************”);

System.out.println(“***** 1.修改学号 *****”);

System.out.println(“***** 2.修改班级 *****”);

System.out.println(“***** 3.修改姓名 *****”);

System.out.println(“****************************************”);

System.out.print(“请选择:”);

moi=pin.nextInt();

switch(moi)

{

case 1:System.out.print(“请输入新的学号:”);num3=pin.nextInt();s[t].num=num3;break;

case 2:System.out.print(“请输入新的班级:”);str1=pin.next();s[t].classAge=str1;break;

case 3:System.out.print(“请输入新的姓名:”);str2=pin.next();s[t].name=str2;break;

}

System.out.println(“数据已成功修改!”);

}

System.out.print(“是否继续修改(Y/N)”);

str=pin.next();

ch=str.charAt(0);

System.out.println();

while(ch!=’Y’&&ch!=’y’&&ch!=’N’&&ch!=’n’)

{

System.out.print(“输入有误,请重新输入:”);

str=pin.next();

ch=str.charAt(0);

}

if(ch==’N’||ch==’n’)

{

break;

}

}

}

System.out.println();

System.out.println(“系统返回主菜单!”);

this.menu();

}

public static void main(String[] args)throws IOException

{

Student stu=new Student();

for(int i=0;i<2;i++)

{

s[i]=new Student();

}

stu.menu();

}

}

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持编程小技巧。

相关

总结

以上是编程之家为你收集整理的java学生信息管理系统源代码全部内容,希望文章能够帮你解决java学生信息管理系统源代码所遇到的程序开发问题。

如果觉得编程之家网站内容还不错,欢迎将编程之家网站推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。

如您喜欢交流学习经验,点击链接加入交流1群:1065694478(已满)交流2群:163560250

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/192957.html原文链接:https://javaforall.net

(0)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • CMD查看端口占用情况,8080端口被TIM占用了「建议收藏」

    CMD查看端口占用情况,8080端口被TIM占用了「建议收藏」CMD查看端口占用情况,8080端口被TIM占用了安装新版本dubboAdmin的时候,启动后端项目dubbo-admin-server报一下错误:org.apache.catalina.LifecycleException:Protocolhandlerstartfailed atorg.apache.catalina.connector.Connector.startInternal(Connector.java:1008) atorg.apache.catalina.util.Li

    2022年5月19日
    65
  • LaTeX数学公式-详细教程

    LaTeX数学公式-详细教程LaTeX数学公式,包含前言,注意事项,插入公式,注释,编号,转义字符,换行与对齐,字体,空格,上下标,括号,大括号和行标,分式,开方,对数,省略号,最值,方程组和分段函数,累加和累乘,矢量,积分,极限,导数与偏导,矩阵,表格,希腊字母,运算符,戴帽符号,特殊符号,等等。

    2022年5月23日
    32
  • 笔记7 正则(grep、sed、awk工具)

    笔记7 正则(grep、sed、awk工具)

    2021年6月6日
    104
  • mac全选文字的快捷键_Mac文本快捷键你知道多少?

    mac全选文字的快捷键_Mac文本快捷键你知道多少?我们在MAC电脑上码字的时候,经常会遇到需要对某段文字进行修改或者操作的情况,相信很多人的做法是用鼠标去移动光标快速定位,如果字数篇幅比较小也是可以的,但是如果遇到大篇幅的文章,一点点的用鼠标去找会非常麻烦,今天我就教大家几个MAC文本快捷键,让你在最短的时间内把光标移动到你想要的位置,提高在电脑上码字的效率。image1、全文&段落定位目标位置比较远的时候,需要对光标远程定位,下面的组合…

    2022年5月26日
    55
  • idea远程debug weblogic_idea远程调试代码

    idea远程debug weblogic_idea远程调试代码https://blog.csdn.net/u013559614/article/details/123375027Idea远程调试tomcatIdea配置配置remote传输方式,默认为Socket​Socket:macOS及Linux系统使用此种传输方式;​Sharedmemory:Windows系统使用此种传输方式。​调试模式,默认为Attach​Attach:此种模式下,调试服务端(被调试远程运行的机器)启动一个端口等待我们(调试客户端)去连接;​

    2022年9月10日
    0
  • 小程序父组件向子组件传值

    小程序父组件向子组件传值子组件:tabs1父组件:demo04先将子组件和父组件直接产生特定的联系,需要在demo04.json里面以键值对的方式添加。添加完毕后在父组件中就可以使用标签,就可以渲染出子组件内容。因为tabs1多次复用,所以数据不能在tabs1.js中写死。一般都是由父组件中data数据传到子组件。1.先在父组件data中添加list数据,data:{list:[{id:“2”,nam…

    2022年5月18日
    40

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号