java程序错误如何改_求修改程序。。。打不出来。。。。显示没有错误啊

该楼层疑似违规已被系统折叠 隐藏此楼查看此楼

代码:发不了压缩文件。。。因为没有头衔。。。。

package javaapplication78;

public class JavaApplication78 {

public static void main(String[] args) {

People p1=new People("chiris","M","bEIJING");

BankAccount b = new BankAccount("ChrisAccount", 1,1000.0,p1);

boolean withdrawWorked = b.withdraw(1000);

System.out.println(withdrawWorked);

System.out.println(b.display());

b.deposit(2000);

System.out.println(b.display());}}

第二个class:

package javaapplication78;

import java.text.ParseException;

import java.text.SimpleDateFormat;

import java.util.ArrayList;

import java.util.Date;

import java.util.Iterator;

import java.util.Scanner;

public class DataInput {

static Scanner kb = new Scanner(System.in);

public void dataEntry() {

ArrayList listOfAccounts = null;

System.out.println("Enter the accountNumber:");

int n = kb.nextInt();

System.out.print("Enter the pinnumber:");

int g = kb.nextInt();

Iteratorit=listOfAccounts.iterator();

while(it.hasNext()){

BankAccount an=it.next();

if(an.accountnumber()==n){

if(an.pinnumber()==g){

System.out.println("Welcome");

}else{System.out.println("WRONG CODE");}}else{System.out.println("WRONG NUMBER");

}}}}

第3个class:

package javaapplication78;

import java.util.ArrayList;

public class People {

private String name;

private String gender;

private String address;private int idNumber;

public static int lastId = 0;

public static ArrayList listOfPeople = new ArrayList();

public People(String name,String gender,String address){

this.name=name;

this.gender=gender;

this.address=address;

lastId++;

this.idNumber = lastId;

listOfPeople.add(this);

}

public String getName() {

return name;

}}

第4个class:

package javaapplication78;

import java.util.ArrayList;

import java.util.Scanner;

public class BankAccount {

// object attributes

private String accountName;

private double accountBalance;

private int accountNumber;

private int pinNumber;

private People accountOwner;

// class attributes

public static ArrayList listOfAccounts;

private static int lastAccountNumber=0000000;

public BankAccount(String name ,int pinnumber, double balance,People owner){

this.accountName=name;

this.pinNumber=pinnumber;

this.accountBalance=balance;

this.accountOwner = owner;

lastAccountNumber++;

this.accountNumber = lastAccountNumber;

listOfAccounts.add(this); }

public int accountnumber(){

return accountNumber;}

public int pinnumber(){

return pinNumber;}

public String accountDetails() {

String details = "";

details = details + "Account name: " + this.accountName + "\n";

details = details + "Account owner: " + this.accountOwner.getName() + "\n";

details= details + "Account number: " + this.accountNumber + "\n";

details=details+"Account pin number"+this.pinNumber+"\n";

details = details + "Account balance: " + this.accountBalance + "\n";

return details;

}

public boolean withdraw(double m){ boolean ok = false;

if (this.accountBalance >= m) {

this.accountBalance = this.accountBalance - m;

ok = true; }

return ok; }

public void deposit(double m) { this.accountBalance = this.accountBalance + m;

}

public String display(){

String display="";

display=display+"accountbalance:"+accountBalance;

return display;

}}

求大神啊啊啊啊啊啊啊。。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值