Driver から BankAccount に変動残高とデポジットを送金するのに問題があります。誰かアドバイスはありますか? 私はBlueJを使用しています。
これがドライバークラスとメソッドです-
import javax.swing.JOptionPane;
public class Driver
{
int choice;
String number;
String name;
double deposit;
double withdraw;
double balance;
//public Driver()
public Driver()
{
String number = JOptionPane.showInputDialog("1. Deposit 2. Withdraw 3. Balance 4. Change name 5. Exit");
int choice = Integer.parseInt(number);
do
{
if( choice == 1)
{
String input = JOptionPane.showInputDialog("How much would you like to deposit?");
deposit = Integer.parseInt(input);
BankAccount b = new BankAccount();
b.Deposit();
Driver a = new Driver();
そして、これが BankAccount プログラムです。
public class BankAccount
{
double balance = 400;
double deposit;
double withdraw;
double Interest = 1.05;
String name;
String accountNumber;
public double Deposit()
{
//String input = JOptionPane.showInputDialog("How much would you like to deposit?");
//deposit = Integer.parseInt(input);
if (deposit < 10000)
{
balance = deposit + balance;
}
return balance;
}