عندي مشكلة في هذا الكود ::
حيث أني عندما أقوم بتشغيله , وإدخال البيانات فإنه لا يعطي النتائج بشكل صحيح
public class Account
{
int accountNo;
double valueAtBank;
public Account(int accountNo,double valueAtBank)
{
this.accountNo=accountNo;
this.valueAtBank=valueAtBank;
}
public int getAccountNo()
{
return accountNo;
}
public double getValueAtBank()
{
return valueAtBank;
}
}//////////////////////////////////////////////////////////////////////////////////
import java.util.*;
import javax.swing.*;
public class Customer
{
int no;
String name;
Account account[]=new Account[3];
public Customer()
{
}
public Customer(int n,String na,Account []a)
{
no=n;
name=na;
account=a;
}
public static void main(String[]args)
{
double amount;
int id;
int accountNo;
String name;
String yes1,yes2;
int counter1=0,counter2=0;
Scanner input=new Scanner(System.in);
Customer []customer=new Customer[100];
Account [] account=new Account[3];
do
{
counter1=0;
/* System.out.println("Enter the id Number : ");
id=input.nextInt();*/
id=Integer.parseInt(JOptionPane.showInputDialog(null,"Enter the No : "));
name=JOptionPane.showInputDialog(null,"Enter the name : ");
// System.out.println("Enter the Name : ");
// name=input.nextLine();
do
{
accountNo=Integer.parseInt(JOptionPane.showInputDialog(null,"Enter the AccountNo : "));
// System.out.println("Enter the AccountNo : ");
// accountNo=input.nextInt();
amount=Double.parseDouble(JOptionPane.showInputDialog(null,"Enter the Ammount of that : "));
/* System.out.println("Enter the Ammount of that : ");
amount=input.nextDouble();*/
account[counter1]=new Account(accountNo,amount);
++counter1;
yes1=JOptionPane.showInputDialog(null,"Press <Y> to enter new account : ");
/* System.out.println("Press <Y> to enter new account : ");
yes1=input.nextLine();*/
}
while((yes1.equalsIgnoreCase("Y")));
customer[counter2]=new Customer(id,name,account);
counter2++;
yes2=JOptionPane.showInputDialog(null,"Press <Y> to enter new Data");
/* System.out.println("Press <Y> to enter new Data : ");
yes2=input.nextLine();*/
}
while(yes2.equalsIgnoreCase("Y")&&(counter1<100));
///////////////////////////////////////////////////////////////////////
for(int x=0;x<counter2;x++)
{
for(int z=0;z<counter1;z++)
System.out.println(customer[x].account[z].getAccountNo()+"\t"+customer[x].account[z].getValueAtBank()+"\t"+
customer[x].no+"\t"+customer[x].name+"\n");
}
}
}