资讯

精准传达 • 有效沟通

从品牌网站建设到网络营销策划,从策略到执行的一站式服务

管理系统java代码 员工信息管理系统java代码

如何编写Myshopping管理系统java程序代码

import java.util.Scanner;

成都创新互联是一家专业提供右江企业网站建设,专注与成都网站制作、成都网站设计、H5建站、小程序制作等业务。10年已为右江众多企业、政府机构等服务。创新互联专业网站建设公司优惠进行中。

public class AddCustomer{

public static void main(String[] args){

System.out.printIn("MyShopping管理系统 客户信息管理 添加客户信息\n");

int custNo; //会员号

int birthday; //会员生日

int points = 0; //会员积分

Scanner input=new Scanner(System.in);

for(int i=0;i3;i++){ //循环录入会员信息

System.out.printIn("请输入会员号(4位整数):");

custNo = input.nextInt();

System.out.printIn("请输入会员生日(月\日用两位整数表示):");

custNo = input.next();

System.out.printIn("请输入会员积分:");

custNo = input.nextInt();

if(custNo1000||custNo9999){ //会员号无效则跳出

System.out.printIn("客户号"+custNo+"是无效会员号!");

System.out.printIn("录入信息失败\n");

contiune;

}

System.out.printIn("您录入的会员信息是:");

System.out.printIn(custNo+" "+birthday+" "+points+ "\n");

}

System.out.printIn("程序结束!");

}

}

求用Java编写的学生成绩管理系统的完整代码,要能运行的

以下方法实现了用户界面登陆

import java.awt.*;

import java.awt.event.*;

public class DengLuJieMian extends Frame implements ActionListener

{

Label username=new Label("用户名:");//使用文本创建一个用户名标签

TextField t1=new TextField();//创建一个文本框对象

Label password=new Label("密码:");//创建一个密码标签

TextField t2=new TextField();

Button b1=new Button("登陆");//创建登陆按钮

Button b2=new Button("取消");//创建取消按钮

public DengLuJieMian()

{

this.setTitle("学生信息管理系统");//设置窗口标题

this.setLayout(null);//设置窗口布局管理器

username.setBounds(50,40,60,20);//设置姓名标签的初始位置

this.add(username);// 将姓名标签组件添加到容器

t1.setBounds(120,40,80,20);// 设置文本框的初始位置

this.add(t1);// 将文本框组件添加到容器

password.setBounds(50,100,60,20);//密码标签的初始位置

this.add(password);//将密码标签组件添加到容器

t2.setBounds(120,100,80,20);//设置密码标签的初始位置

this.add(t2);//将密码标签组件添加到容器

b1.setBounds(50,150,60,20);//设置登陆按钮的初始位置

this.add(b1);//将登陆按钮组件添加到容器

b2.setBounds(120,150,60,20);//设置取消按钮的初始位置

this.add(b2);// 将取消按钮组件添加到容器

b1.addActionListener(this);//给登陆按钮添加监听器

b2.addActionListener(this);// 给取消按钮添加监听器

this.setVisible(true);//设置窗口的可见性

this.setSize(300,200);//设置窗口的大小

addWindowListener(new WindowAdapter()

{

public void windowClosing(WindowEvent e)

{

System.exit(0);

}

});//通过内部类重写关闭窗体的方法

}

public void actionPerformed(ActionEvent e)

{

if(e.getSource()==b1)//处理登陆事件

{

String name=t1.getText();

String pass=t2.getText();

if(name!=nullpass.equals("000123"))//判断语句

{

new StudentJieMian();

}

}

}

public static void main(String args[])//主函数

{

new DengLuJieMian();

}

}

以下方法实现了学生界面设计

import java.awt.*;

import java.awt.event.*;

class StudentJieMian extends Frame implements ActionListener

{

MenuBar m=new MenuBar();//创建菜单栏

Menu m1=new Menu("信息");//创建菜单“信息”

MenuItem m11=new MenuItem("插入");//创建“插入”的菜单项

MenuItem m12=new MenuItem("查询");

Menu m2=new Menu("成绩");//创建菜单“成绩”

MenuItem m21=new MenuItem("查询");

public StudentJieMian()

{

this.setTitle("学生界面");//设置窗口标题

this.setLayout(new CardLayout());//设置窗口布局管理器

this.setMenuBar(m);//将菜单栏组件添加到容器

m.add(m1);//将信息菜单放入菜单栏

m.add(m2);

m1.add(m11);//将“插入”菜单项添加到“信息”菜单

m1.add(m12); //将“查询”菜单项添加到“信息”菜单

m2.add(m21); //将“查询”菜单项添加到“成绩”菜单

m11.addActionListener(this); //给“插入”菜单项添加监听器

m12.addActionListener(this); //给“查询”菜单项添加监听器

m21.addActionListener(this); //给“查询”菜单项添加监听器

this.setVisible(true); //设置窗口的可见性

this.setSize(300,200); //设置窗口的大小

addWindowListener(new WindowAdapter()

{

public void windowClosing(WindowEvent e)

{

System.exit(0);//关闭窗口

}

});

}

public void actionPerformed(ActionEvent e)

{

if(e.getSource()==m11) //处理“添加信息”事件

{

new AddStudent();

}

if(e.getSource()==m12) //处理“查询信息”事件

{

new SelectStudent();

}

if(e.getSource()==m21) //处理“查询成绩”事件

{

new ChengJiStudent();

}

}

public static void main(String args[])

{ new StudentJieMian(); //创建一个对象 }

一个java管理系统多少行代码

1,java规范中一般不建议一个java类中超过500行

2,一行的长度不超过200个

3,按照规定格式将代码格式化

简单的JAVA学生管理系统代码···

lListStudent students = new ArrayListStudent();

BufferedReader br = new BufferedReader(new FileReader("D:\student.txt"));

String tmpStr = br.readLine();

while(tmpStr != null){

int firstIndex = tmpStr.indexOf(" ");

int secondIndex = tmpStr.indexOf(" ",firstIndex + 1);

int thirdIndex = tmpStr.indexOf(" ", secondIndex + 1);

int forthIndex = tmpStr.indexOf(" ", thirdIndex + 1);

Integer stuId = Integer.parseInt(tmpStr.substring(0,firstIndex));

String stuName = tmpStr.substring(firstIndex + 1,secondIndex);

Integer stuYW = Integer.parseInt(tmpStr.substring(secondIndex + 1,thirdIndex));

Integer stuSX = Integer.parseInt(tmpStr.substring(thirdIndex + 1,forthIndex));

Integer stuYY = Integer.parseInt(tmpStr.substring(forthIndex + 1));

Student student = new Student();

student.setStuId(stuId);

student.setStuName(stuName);

student.setStuYW(stuYW);

student.setStuSX(stuSX);

student.setStuYY(stuYY);

students.add(student);

tmpStr.readLine();

}

//创建一个学生实体类 封装stuId stuName stuYW stuSx stuYY 这5个属性。。。

//已经帮你把数据拆分出来 并以Student 对象的形式放入集合中了 接下来 给分吧 哇咔咔

学生考试管理系统,JAva源代码

//主类EnglishTest——

import java.awt.*;

import java.awt.event.*;

import javax.swing.*;

public class EnglishTest extends JFrame

{

TestArea testPanel=null;

Container con=null;

public EnglishTest()

{

super("模拟考试");

testPanel=new TestArea();

con=getContentPane();

con.add(testPanel,BorderLayout.CENTER);

addWindowListener(new WindowAdapter()

{ public void windowClosing(WindowEvent e)

{ System.exit(0);

}

});

setVisible(true);

setBounds(60,40,660,460);

con.validate();

validate();

}

public static void main(String args[])

{

new EnglishTest();

}

}

//读取试题 ReadTestquestion

import java.io.*;

import java.util.*;

public class ReadTestquestion

{ String filename="",

correctAnswer="",

testContent="" ,

selection="" ;

int score=0;

long time=0;

boolean 完成考试=false;

File f=null;

FileReader in=null;

BufferedReader 读取=null;

public void setFilename(String name)

{ filename=name;

score=0;

selection="";

try {

if(in!=null读取!=null)

{

in.close();

读取.close();

}

f=new File(filename);

in=new FileReader(f);

读取=new BufferedReader(in);

correctAnswer=(读取.readLine()).trim();

String temp=(读取.readLine()).trim() ;

StringTokenizer token=new StringTokenizer(temp,":");

int hour=Integer.parseInt(token.nextToken()) ;

int minute=Integer.parseInt(token.nextToken());

int second=Integer.parseInt(token.nextToken());

time=1000*(second+minute*60+hour*60*60);

}

catch(Exception e)

{

testContent="没有选择试题";

}

}

public String getFilename()

{

return filename;

}

public long getTime()

{

return time;

}

public void set完成考试(boolean b)

{

完成考试=b;

}

public boolean get完成考试()

{

return 完成考试;

}

public String getTestContent()

{ try {

String s=null;

StringBuffer temp=new StringBuffer();

if(读取!=null)

{

while((s=读取.readLine())!=null)

{

if(s.startsWith("**"))

break;

temp.append("\n"+s);

if(s.startsWith("endend"))

{

in.close();

读取.close();

完成考试=true;

}

}

testContent=new String(temp);

}

else

{

testContent=new String("没有选择试题");

}

}

catch(Exception e)

{

testContent="试题内容为空,考试结束!!";

}

return testContent;

}

public void setSelection(String s)

{

selection=selection+s;

}

public int getScore()

{ score=0;

int length1=selection.length();

int length2=correctAnswer.length();

int min=Math.min(length1,length2);

for(int i=0;imin;i++)

{ try{

if(selection.charAt(i)==correctAnswer.charAt(i))

score++;

}

catch(StringIndexOutOfBoundsException e)

{

i=0;

}

}

return score;

}20:10 03-8-31

public String getMessages()

{

int length1=selection.length();

int length2=correctAnswer.length();

int length=Math.min(length1,length2);

String message="正确答案:"+correctAnswer.substring(0,length)+"\n"+

"你的回答:"+selection+"\n";

return message;

}

}

//考试区域TestArea

import java.awt.*;

import javax.swing.*;

import java.awt.event.*;

import java.io.*;

class FileName implements FilenameFilter

{

String str=null;

FileName (String s)

{

str="."+s;

}

public boolean accept(File dir,String name)

{

return name.endsWith(str);

}

}

public class TestArea extends JPanel implements ActionListener,ItemListener,Runnable

{

Choice list=null;

JTextArea 试题显示区=null,消息区=null;

JCheckBox box[];

JButton 提交该题答案,读取下一题,查看分数;

ReadTestquestion 读取试题=null;

JLabel welcomeLabel=null;

Thread countTime=null;

long time=0;

JTextField timeShow=null;

boolean 是否关闭计时器=false,

是否暂停计时=false;

JButton 暂停或继续计时=null;

public TestArea()

{

list= new Choice();

String 当前目录=System.getProperty("user.dir");

File dir=new File(当前目录);

FileName fileTxt=new FileName("txt");

String fileName[]=dir.list(fileTxt);

for(int i=0;ifileName.length;i++)

{

list.add(fileName[i]);

}

试题显示区=new JTextArea(15,12);

试题显示区.setLineWrap(true);

试题显示区.setWrapStyleWord(true);

试题显示区.setFont(new Font("TimesRoman",Font.PLAIN,14));

试题显示区.setForeground(Color.blue);

消息区=new JTextArea(8,8);

消息区.setForeground(Color.blue);

消息区.setLineWrap(true);

消息区.setWrapStyleWord(true);

countTime=new Thread(this);

String s[]={"A","B","C","D"};

box=new JCheckBox[4];

for(int i=0;i4;i++)

{

box[i]=new JCheckBox(s[i]);

}

暂停或继续计时=new JButton("暂停计时");

暂停或继续计时.addActionListener(this);

提交该题答案=new JButton("提交该题答案");

读取下一题=new JButton("读取第一题");

读取下一题.setForeground(Color.blue);

提交该题答案.setForeground(Color.blue);

查看分数=new JButton("查看分数");

查看分数.setForeground(Color.blue);

提交该题答案.setEnabled(false);

提交该题答案.addActionListener(this);

读取下一题.addActionListener(this);

查看分数.addActionListener(this);

list.addItemListener(this);

读取试题=new ReadTestquestion();

JPanel pAddbox=new JPanel();

for(int i=0;i4;i++)

{

pAddbox.add(box[i]);

}

Box boxH1=Box.createVerticalBox(),

boxH2=Box.createVerticalBox(),

baseBox=Box.createHorizontalBox();

boxH1.add(new JLabel("选择试题文件"));

boxH1.add(list);

boxH1.add(new JScrollPane(消息区));

boxH1.add(查看分数);

timeShow=new JTextField(20);

timeShow.setHorizontalAlignment(SwingConstants.RIGHT);

timeShow.setEditable(false);

JPanel p1=new JPanel();

p1.add(new JLabel("剩余时间:"));

p1.add(timeShow);

p1.add(暂停或继续计时);

boxH1.add(p1);

boxH2.add(new JLabel("试题内容:"));

boxH2.add(new JScrollPane(试题显示区));

JPanel p2=new JPanel();

p2.add(pAddbox);

p2.add(提交该题答案);

p2.add(读取下一题);

boxH2.add(p2);

baseBox.add(boxH1);

baseBox.add(boxH2);

setLayout(new BorderLayout());

add(baseBox,BorderLayout.CENTER);

welcomeLabel=new JLabel("欢迎考试,提高英语水平",JLabel.CENTER);

welcomeLabel.setFont(new Font("隶书",Font.PLAIN,24));

welcomeLabel.setForeground(Color.blue);

add(welcomeLabel,BorderLayout.NORTH);

}

public void itemStateChanged(ItemEvent e)

{

timeShow.setText(null);

是否关闭计时器=false;

是否暂停计时=false;

暂停或继续计时.setText("暂停计时");

String name=(String)list.getSelectedItem();

读取试题.setFilename(name);

读取试题.set完成考试(false);

time=读取试题.getTime();

if(countTime.isAlive())

{

是否关闭计时器=true;

countTime.interrupt();

}

countTime=new Thread(this);

消息区.setText(null);

试题显示区.setText(null);

读取下一题.setText("读取第一题");

提交该题答案.setEnabled(false);

读取下一题.setEnabled(true);

welcomeLabel.setText("欢迎考试,你选择的试题:"+读取试题.getFilename());

}

public void actionPerformed(ActionEvent e)

{

if(e.getSource()==读取下一题)

{

读取下一题.setText("读取下一题");

提交该题答案.setEnabled(true);

String contentTest=读取试题.getTestContent();

试题显示区.setText(contentTest);

消息区.setText(null);

读取下一题.setEnabled(false);

try {

countTime.start();

}

catch(Exception event)

{

}

}

if(e.getSource()==提交该题答案)

{

读取下一题.setEnabled(true);

提交该题答案.setEnabled(false);

String answer="?";

for(int i=0;i4;i++)

{

if(box[i].isSelected())

{

answer=box[i].getText();

box[i].setSelected(false);

break;

}

}

读取试题.setSelection(answer);

}

if(e.getSource()==查看分数)

{

int score=读取试题.getScore();

String messages=读取试题.getMessages();

消息区.setText("分数:"+score+"\n"+messages);

}

if(e.getSource()==暂停或继续计时)

{

if(是否暂停计时==false)

{

暂停或继续计时.setText("继续计时");

是否暂停计时=true;

}

else if(是否暂停计时==true)

{

暂停或继续计时.setText("暂停计时");

是否暂停计时=false;

countTime.interrupt();

}

}

}

public synchronized void run()

{

while(true)

{

if(time=0)

{

是否关闭计时器=true;

countTime.interrupt();

提交该题答案.setEnabled(false);

读取下一题.setEnabled(false);

timeShow.setText("用时尽,考试结束");

}

else if(读取试题.get完成考试())

{

是否关闭计时器=true;

timeShow.setText("考试效果:分数*剩余时间(秒)="+1.0*读取试题.getScore()*(time/1000));

countTime.interrupt();

提交该题答案.setEnabled(false);

读取下一题.setEnabled(false);

}

else if(time=1)

{

time=time-1000;

long leftTime=time/1000;

long leftHour=leftTime/3600;

long leftMinute=(leftTime-leftHour*3600)/60;

long leftSecond=leftTime%60;

timeShow.setText(""+leftHour+"小时"+leftMinute+"分"+leftSecond+"秒");

}

try

{

Thread.sleep(1000);

}

catch(InterruptedException ee)

{

if(是否关闭计时器==true)

return ;

}

while(是否暂停计时==true)

{

try

{

wait();

}

catch(InterruptedException ee)

{

if(是否暂停计时==false)

{

notifyAll();

}

}

}

}

}

}

用JAVA怎么编写停车场管理系统源代码?

importjava.text.SimpleDateFormat;\x0d\x0aimportjava.util.Date;\x0d\x0aimportjava.util.Scanner;\x0d\x0a\x0d\x0a/*********************************\x0d\x0a*停车场管理\x0d\x0a*authorzhang\x0d\x0a*2013-12-13\x0d\x0a********************************/\x0d\x0apublicclassCarStopManager{\x0d\x0a\x0d\x0apublicstaticvoidmain(String[]args){\x0d\x0aScannersc=newScanner(System.in);\x0d\x0a\x0d\x0aSystem.out.println("请入车牌号:");\x0d\x0aStringcarno=sc.next();\x0d\x0aCarStopManagercarStopManager=newCarStopManager();\x0d\x0acarStopManager.setCarNo(carno);//设置车牌号\x0d\x0a\x0d\x0aSimpleDateFormatformat=newSimpleDateFormat("yyyy-MM-ddHH:mm:ss");\x0d\x0aStringsdate=format.format(newDate());\x0d\x0aSystem.out.println("当前时间(入场时间)是:"+sdate);\x0d\x0a\x0d\x0aSystem.out.println("需要开出车场吗?yes/no:");\x0d\x0aStringyesno=sc.next();\x0d\x0a\x0d\x0aif(yesno.equals("yes")){\x0d\x0aStringedate=format.format(newDate());\x0d\x0aSystem.out.println("出场时间是:"+edate);\x0d\x0a//计算方法\x0d\x0acarManager(2,sdate,edate,carStopManager);\x0d\x0a}\x0d\x0a}\x0d\x0a/**\x0d\x0a*计算方法\x0d\x0a*/\x0d\x0apublicstaticvoidcarManager(inttype,StringstarTime,\x0d\x0aStringendTime,CarStopManagercarStopManager){\x0d\x0a\x0d\x0aif(type==1){//按月收费\x0d\x0aSystem.out.println("如若没有缴纳月费请缴纳800元,如若缴纳将不再提示!");\x0d\x0a}else{\x0d\x0a/**\x0d\x0a*一般不会有停车几个月的吧?先不考虑停车几年或者几个月的\x0d\x0a*/\x0d\x0aStringsDay=starTime.substring(8,10);//入场日期(天)\x0d\x0aStringsHour=starTime.substring(11,13);//入场小时\x0d\x0aStringsMM=starTime.substring(14,16);//入场分钟\x0d\x0a\x0d\x0aStringeDay=starTime.substring(8,10);//出场日期(天)\x0d\x0aStringeHour=endTime.substring(11,13);//出厂小时\x0d\x0aStringeMM=endTime.substring(14,16);//出厂分钟\x0d\x0a\x0d\x0afloatmoney=0;//需缴纳的费用\x0d\x0aintshour=Integer.parseInt(sHour);\x0d\x0aintehour=Integer.parseInt(eHour);\x0d\x0aintsmm=Integer.parseInt(sMM);\x0d\x0aintemm=Integer.parseInt(eMM);\x0d\x0aintrehour=0;//停车几个小时\x0d\x0a\x0d\x0aif(sDay.equals(eDay)){//同一天\x0d\x0a//当天6点到20点之间\x0d\x0aif((shour=6shour

回答于 2022-12-14


本文标题:管理系统java代码 员工信息管理系统java代码
网址分享:http://cdkjz.cn/article/hpjeoh.html
多年建站经验

多一份参考,总有益处

联系快上网,免费获得专属《策划方案》及报价

咨询相关问题或预约面谈,可以通过以下方式与我们联系

业务热线:400-028-6601 / 大客户专线   成都:13518219792   座机:028-86922220