我几乎完成了一个项目,但几乎没有什么指导,我不确定我是否正确。下面的代码以三个带参数的方法结尾,但我不知道如何处理它们或如何回应“给他们做点什么”的评论。有什么建议么?有不止一种选择吗?谢谢。
public class Banktest {
public static void main(String[] args) {
BankAccount SM = new BankAccount("Sam", "Gamgee");
System.out.println(SM.firstname + SM.lastname);
SM.setAccountbalance();
SM.setAccountNumber();
System.out.println(SM.firstname + " " + SM.lastname
+ " " + SM.accountbalance + " " + SM.accountnumber);
}
}
银行账户类
public class BankAccount {
public String firstname;
public double accountbalance;
public String lastname;
public int accountnumber;
public BankAccount() {
}
public BankAccount(String firstname, String lastname, int accountnumber) {
this.firstname = firstname;
this.lastname = lastname;
this.accountnumber = accountnumber;
this.accountbalance = 0;
}
public BankAccount(String firstname, String lastname,
int accountnumber, double accountbalance) {
this.firstname = firstname;
this.lastname = lastname;
this.accountnumber = accountnumber;
this.accountbalance = accountbalance;
}
public BankAccount(String firstname, String lastname) {
this.firstname = firstname;
this.lastname = lastname;
}
public void setName(String firstname, String lastname) {
}
public void setAccountNumber(int accountnumber) {
}
public void setAccountbalance(double accountbalance) {
}
}