I am writing a java project on a bank. The main class calls another class called Account. I have 10 accounts so I have to make 10 objects.
Is it possible to make an array of such objects? If so How?.
Here is the code for the Account class code:
import java.util.*;
import java.io.*;
class Account
{
private String Name;
private int age;
private long accnum;
private int pin;
private int phone;
private boolean gender;
private double balance;
private double interest;
private int lastpin;
public Account(String nm,int ag,long acc,int phon,boolean gen,double bal,int last)
{
    Name = nm;
    age = ag;
    accnum = acc;
    phone = phon;
    gender = gen;
    balance = bal;
    lastpin = last;
    pin = Random(lastpin);
}
public int Random(int num)
{
    int count = 0;
    num = num * 1103;
    int num1=num;
    int divide = 1;
    test:
    while(true){
    while(num != 0)
    {
        num =(int)(num/10);
        //num /= 10;
        ++count;
    }
    if(count > 4)
    divide =(int)(Math.pow(10,(count - (count - 3))));
    else if(count < 4)
    {
        num1 = num1 * 11;
        continue test;
    }
    break test;
  }
  lastpin = (num1/divide);
  return (num1/divide);      
}
public void Deposit(double amount)
{
    balance = balance + amount;
}
/**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
/*public String[] Initnm(String x[]){
   for(int i = 0,j = 0;i < x.length || j < x.length;i++,j++){
       char ch = (char)j;
       x[i] = Character.toString(ch);;
    }
   return x;
}*/
//sha
private long[] Initacc(long x[]){
   for(long i = 0;i < x.length ; i++){
       if(((int) Math.log10(i) + 1) == 1)
       x[(int)i] = Long.parseLong("10105175407".concat("00".concat(Long.toString(i))));
       else if(((int) Math.log10(i) + 1) == 2)
       x[(int)i] = Long.parseLong("10105175407".concat("0".concat(Long.toString(i))));
       else if(((int) Math.log10(i) + 1) == 3)
       x[(int)i] = Long.parseLong("10105175407".concat(Long.toString(i)));
    }
    return x;
 }   
private int[][] InitAgenda(int[][]x)
{
    for(int i = 0;i < x.length;i++)
    {
        x[0][i] = 100;
        x[1][i] = 0;
    }
    return x;
}
private int[] Initpin(int x[]){
    for(int i = 0,j = 1000;i < x.length;i++,j++){
        x[i] = j;
    }
    return x;
}
private double[] Initbal(double x[]){
    for(int i = 0;i < x.length;i++){
        x[i] = 200.00d;
    }
    return x;
}
private double[] Initirst(double x[],char ch){
    for(int i = 0;i < x.length;i++){
        if(ch == 's')
        x[i] = 3.10d ;
        else if(ch == 'c')
        x[i] = 0.0d;
    }
    return x;
}
 }
This is the Account class which handles all the accounts. The main class is too long to be shown. Thank you all.
 
    