import java.util.*;
class Customers
{
private String name;
private int accountno;
private String status;
private String type;
private int currbal;
private String Login;
private int Pin;
public Customers()
{
this.name = " ";
this.accountno = accountno;
this.currbal = currbal;
}
public Customers( String name1, int A, int Bal)
{
name = name1;
accountno = A;
currbal = Bal;
}
public Customers ( String name1,int accountno1, String status1, String type1, int curr, String Login1, int Pin1)
{
name = name1;
accountno = accountno1;
status = status1;
type = type1;
currbal = curr;
Login = Login1;
Pin = Pin1;
}
public String getHolderName()
{
return name;
}
}
class ATMmain
{
public static void main( String [] args)
{
int count = 1;
Customers [] Carray = new Customers [100];
//Customers [] C1 = new Customers[1];
//Customers [] C2 = new Customers[1];
System.out.println(createNewAccount(count, Carray));
System.out.println(createNewAccount(count, Carray));
}
public static int createNewAccount( int count, Customers [] Carray)
{
//Customers [] Carray = new Customers[10];
System.out.println("Enter account information");
Scanner S = new Scanner (System.in);
System.out.println("Login:");
String log = S.next();
System.out.println("Pin Code:");
int Pin = S.nextInt();
System.out.println("Holder's name: ");
String holderN = S.next();
System.out.println("Type:" );
String type = S.next();
if (!type.equals("Savings") && !type.equals("Current"))
{
System.out.println("error type! please Re-enter");
System.out.println("Type:" );
type = S.next();
}
System.out.println("Starting Balance:");
int SBal = S.nextInt();
System.out.println("Status:");
String Stat = S.next();
Customers ACC = new Customers(holderN, count,Stat, type,SBal,log, Pin );
Carray[count] = ACC;
System.out.println("Account Successfully created!");
System.out.println("account number is" +count);
count++;
return count;
}
}
/*public void DeleteExistingAcc(int count, Customers [] Carray )
{
System.out.println ("Enter Account Number: ");
Scanner S = new Scanner(System.in);
int acc = S.nextInt();
System.out.print ln("Are you sure you want to delete this Account:" +acc);
Carray[acc].getHolderName();
}
*/
`Inline Code Example Here`
HyperCyber 0 Newbie Poster
JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster
a.b.bavani.sankar 0 Newbie Poster
Slavi 94 Master Poster Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.