135-1821-9792

java系统功能对应代码 java编写的系统

求用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 简单银行系统的代码

import java.io.BufferedReader;

import java.io.IOException;

import java.io.InputStreamReader;

public class AccountDemo {

public static double MONEY = 0;// 初始化金额是100元。

public static void main(String[] args) {

final String USER_NAME = "zhangsan";// 用户名

final String PASSWORD = "123456";// 密橡如配码

while (true) {

System.out.print("请输入用户名:");

String user_name = getString();

System.out.print("请输入密码:");

String password = getString();

if (user_name != null user_name.equals(USER_NAME)

password != null password.equals(PASSWORD)) {

System.out.println("登陆成功!你要干什么?");

while (true) {

System.out.println("1:存款");

System.out.println("2:取款");

System.out.println("3:查询余额");

System.out.println("q:退出程序");

System.out.print("请选择:");

String userIn = getString();

int in = 0;

if (userIn != null userIn.equals("1"橡雹)) {

in = Integer.parseInt(userIn);

} else if (userIn != null userIn.equals("2")) {

in = Integer.parseInt(userIn);

} else if (userIn != null userIn.equals("3")) {

in = Integer.parseInt(userIn);

} else if (userIn != null

userIn.trim().toUpperCase().equals("Q")) {

in = 4;

} else {

System.out.println("你输入的指令不正确!请重新输入。");

continue;

}

switch (in) {

case 1:

double add_money = 0;

while (true) {

System.out.print("请输入你要存入的金额:");

try {

add_money = Double.parseDouble(getString());

} catch (Exception e) {

System.out.println("金额输入不正确!");

continue;

}

break;

}

MONEY += add_money;

System.out.println("存入的金额是" + add_money

+ "\r\n请选择你要的操作:");

break;

case 2:

double money = 0;

while (true) {

System.out.print("请输入梁指你要取出的金额:");

try {

money = Double.parseDouble(getString());

} catch (Exception e) {

System.out.println("金额输入不正确!");

continue;

}

if (money MONEY) {

System.out.println("取出的金额大于现有存款,请重新输入要取出的金额!");

continue;

}

break;

}

MONEY -= money;

System.out.println("取出的金额是" + money + "\r\n请选择你要的操作:");

break;

case 3:

System.out.println("你的余额是:" + MONEY + "\r\n请选择你要的操作:");

break;

case 4:

System.out.println("程序退出!");

return;

}

}

} else {

System.out.println("错误:用户名与密码不匹配!\r\n");

System.out.println("按任意键:重新输入用户名和密码。");

System.out.println("q:退出程序。");

System.out.print("请选择:");

String in = getString();

if (in.trim().toUpperCase().equals("Q")) {

break;

}

}

}

}

public static String getString() {

String str = null;

BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

try {

str = br.readLine();

} catch (IOException e) {

e.printStackTrace();

}

return str;

}

}

关于java中计算机的功能实现代码求大神指导

import java.util.Scanner;

import java.awt.*;

import java.awt.event.*;

public class Test extends WindowAdapter {

Panel p1 = new Panel();

Panel p2 = new Panel();

Panel p3 = new Panel();

TextField txt;

private Button[] b = new Button[17];

private String ss[] = { "7", "8", "9", "+", "4", "5", "6", "-", "1", "2",

"3", "*", "clear", "0", "=", "/", "close" };

static double a;

static String s, str;// 定义变量 创建对像

public static 粗判磨void main(String args[]) {

(new Test()).frame();

}

public void frame() {

Frame fm = new Frame("简单计算器");

for (int i = 0; i = 16; i++) {

b[i] = new Button(ss[i]);

}

for (int i = 0; i = 15; i++) {

p2.add(b[i]);

} // 创建按钮 并添加到P2

b[16].setBackground(Color.yellow);

txt = new TextField(15);

txt.setEditable(false);

for (int i = 0; i = 16; i++) {

b[i].addActionListener(new buttonlistener());// 添加监听器

}

b[16].addActionListener(new close());

fm.addWindowListener(this);

fm.setBackground(Color.red);

p1.setLayout(new BorderLayout());

p1.add(txt, "North");

p2.setLayout(new GridLayout(4, 4));

p3.setLayout(new BorderLayout());

p3.add(b[16]);

fm.add(p1, "North");

fm.add(p2, "Center");

fm.add(p3, "South");

fm.pack();

fm.setVisible(true);// 都是些窗中设置 添加相关组件和监听器

}

public void windowClosing(WindowEvent e) {

System.exit(0);// 退出系统

}

class buttonlistener implements ActionListener {// 编写监听器事件 通冲坦过按键得出给果

public void actionPerformed(ActionEvent e) {

Button btn = (Button) e.getSource();

if (btn.getLabel() == "=") {

jisuan();

str = String.valueOf(a);

txt.setText(str);

s = "";

} else if (btn.getLabel() == "+") {

jisuan();

txt.setText("");

s = "+";

} else if (btn.getLabel() == "-") {

jisuan();

txt.setText("");

s = "-";

} else if (btn.getLabel() == "/") {

jisuan();

txt.setText("");

s = "/";

} else if (btn.getLabel() == "*") {

jisuan();

txt.setText("");

s = "*"岩斗;

} else {

txt.setText(txt.getText() + btn.getLabel());

if (btn.getLabel() == "clear")

txt.setText("");

}

}

public void jisuan() {// 编写具体计算方法

if (s == "+")

a += Double.parseDouble(txt.getText());

else if (s == "-")

a -= Double.parseDouble(txt.getText());

else if (s == "*")

a *= Double.parseDouble(txt.getText());

else if (s == "/")

a /= Double.parseDouble(txt.getText());

else

a = Double.parseDouble(txt.getText());

}

}

}

class close implements ActionListener {// 退出

public void actionPerformed(ActionEvent e) {

System.exit(0);

}

}

用JAVA编写购物系统的代码是什么?(急)

算是最简单的吧

package cn.job01;

import java.util.Scanner;

public class Lx07 {

public static void choice() {

System.out.println("登陆菜单 ");

System.out.println("1登陆宏肆粗系统");

System.out.println("2退出");

}

static void choice1() {

System.out.println("购物管理系统客户信息");

System.out.println("1显示所有客户信息");

System.out.println("2添加客户信息");

System.out.println("3修改客户信息");

System.out.println("4查询客户信息");

}

static void choice2() {

System.out.println("购物管理系统真情回馈");

System.out.println("1幸运大放送");

System.out.println("2幸运抽奖");

System.out.println("3生日问候");

}

public static void main(String[] args) {

choice();

Scanner input = new Scanner(System.in);

System.out.println("请输入1or2");

int num = input.nextInt();

switch (num) {

case 1:

System.out.println("主菜单");

System.out.println("1客户信息管雹衫理");

System.out.println("蔽镇2购物结算");

System.out.println("3真情回馈");

System.out.println("4注销");

break;

}

System.out.println("选择输入数字");

int num1 = input.nextInt();

switch (num1) {

case 1:

choice1();

break;

case 2:

System.out.println("购物结算");

break;

case 3:

choice2();

break;

case 4:

choice();

break;

}

}

}


网站名称:java系统功能对应代码 java编写的系统
文章来源:http://kswsj.com/article/ddpdiig.html

其他资讯



Copyright © 2009-2022 www.kswsj.com 成都快上网科技有限公司 版权所有 蜀ICP备19037934号