有限自动机代码java,自动机自动
用java编写的ATM机源代码
/** * @author admin * 该程序的功能为实现模拟银行ATM自动取款机提款,查询等功能. */ import Java.io.*; /*该类为实现客户信息及部分功能*/ class Account { private String code =null; //信用卡号 private String name =null; //客户姓名 private String password=null; //客户密码 private double money =0.0; //卡里金额 public Account(String code,String name,String password,double money) { this.code=code; this.name=name; this.password=password; this.money=money; } protected String get_Code() { return code; } protected String get_Name() { return name; } protected String get_Password() { return password; } public double get_Money() { return money; } /*得到剩余的钱的数目*/ protected void set_Balance(double mon) { money -= mon; } } /**********实现具体取款机功能*********/ class ATM { Account act; // private String name; // private String pwd; public ATM() { act=new Account("000000","Devil","123456",50000); } /***********欢迎界面***********/ protected void Welcome() { String str="---------------------------------"; System.out.print(str "\n" "欢迎使用Angel模拟自动取款机程序.\n" str "\n"); System.out.print(" 1.取款." "\n" " 2.查询信息." "\n" " 3.密码设置." "\n" " 4.退出系统." "\n"); } /**********登陆系统**********/ protected void Load_Sys() throws Exception { String card,pwd; int counter=0; BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); do { System.out.println("请输入您的信用卡号:"); card=br.readLine(); System.out.println("请输入您的密码:"); pwd=br.readLine(); if(!isRight(card,pwd)) { System.out.println("您的卡号或密码输入有误."); counter ; } else SysOpter(); }while(counter3); Lock_Sys(); } 回复获取全部
创新互联建站是专业的沙河口网站建设公司,沙河口接单;提供成都网站设计、成都网站建设,网页设计,网站设计,建网站,PHP网站建设等专业做网站服务;采用PHP框架,可快速的进行沙河口网站开发网页制作和功能扩展;专业做搜索引擎喜爱的网站,专业的做网站团队,希望更多企业前来合作!
java语言的自动关机的代码
public class RuntimeTest {
public static void main(String[] args)
{
Runtime rt=Runtime.getRuntime();
try
{
rt.exec("shutdown.exe -s -t 40");
/*40的单位为秒,可以改成你想要的任何数字。
如果是想定时关机,可用这句:rt.exec("at 19:00 shutdown.exe -s");19:00可以换成你想要的时间*/
}
catch(Exception e)
{
e.printStackTrace();
}
}
}
用JAVA编出一个细胞自动机的程序,跪求大神帮助!
public class Model {
Integer a[];
Integer b[];
Integer rule[];
Integer TIME_MAX = 41;
Integer NUM_OF_CELL = 41;
public Model() {
a = new Integer[NUM_OF_CELL];
b = new Integer[NUM_OF_CELL];
rule = new Integer[8];
rule[0] = 0;
rule[1] = 1;
rule[2] = 1;
rule[3] = 0;
rule[4] = 1;
rule[5] = 1;
rule[6] = 0;
rule[7] = 0;
for (int i = 0; i NUM_OF_CELL; i++) {
a[i] = 0;
}
a[NUM_OF_CELL / 2] = 1;
}
public static void main(String[] args) {
Model sm = new Model ();
sm.doIt();
}
private void doIt() {
String str = "";
for (int t = 0; t TIME_MAX; t++) {
for (int i = 0; i NUM_OF_CELL; i++) {
b[i] = function(a[(NUM_OF_CELL + i - 1) % NUM_OF_CELL],a[i],a[(i + 1) % NUM_OF_CELL]);
if (a[i] == 0) {
str = "#";
} else {
str = "*";
}
System.out.print(str + " ");
}
System.out.println("");
for (int j = 0; j NUM_OF_CELL; j++) {
a[j] = b[j];
}
}
}
private Integer function(Integer i1, Integer i2, Integer i3) {
if (i1 == 0 i2 == 0 i3 == 0) {
return rule[0];
}
if (i1 == 0 i2 == 0 i3 == 1) {
return rule[1];
}
if (i1 == 0 i2 == 1 i3 == 0) {
return rule[2];
}
if (i1 == 0 i2 == 1 i3 == 1) {
return rule[3];
}
if (i1 == 1 i2 == 0 i3 == 0) {
return rule[4];
}
if (i1 == 1 i2 == 0 i3 == 1) {
return rule[5];
}
if (i1 == 1 i2 == 1 i3 == 0) {
return rule[6];
}
if (i1 == 1 i2 == 1 i3 == 1) {
return rule[7];
}
return 0;
}
}
当前名称:有限自动机代码java,自动机自动
网站URL:http://ybzwz.com/article/hsdjgd.html