hi danpost,
how do i fix this error. have been having this error.
package ATM;
import java.text.DecimalFormat;
import java.util.Scanner;
public class ATM {
static Account[] acc = new Account[10];
static Scanner input = new Scanner(System.in);
static DecimalFormat df = new DecimalFormat("#.00");
public static void main(String[] args)
{
createAccount();//create an account
mainMenu(acc);//the main mean created
}
public static void createAccount()
{
//instantiates the variables
int i;
double bal=50.0;
Clients[] client = new Clients[10];
for(i=0; i<acc.length; i++)
{
//asking for the user information
System.out.println("Enter first name");
String n = input.next();
System.out.println("Enter address");
String a = input.next();
System.out.println("Enter contact");
String c = input.next();
c[i] = new Clients(n, a, c);//created a new person (this is where I am getting the error, array required but string found
}
}
public static void mainMenu(Account[]act)//main menu
{int test;//asking for the user id
do
{
System.out.println("Enter the ID");//getting id
test = input.nextInt();
if(test == -1)
{
System.exit(0);//if user enter the incorrect id the progrm would end
}
else
{
//for loop to iterate the array the amount of times the user would enter the their id
for(int i=0; i<act.length; i++)
{
//checking to see if the user enter the correct id
if(test==(act[i].getID()))
{
atmMenu(act[i]);
break;
}
}
}
}while(test!=-1);
}
public static void atmMenu(Account a)
{
double amt; int sel;
do
{
//asking the user to enter the transaction the user wish to make
System.out.println("Make a selection from the following"//asking the user to make a choice
+ "\n1\tBalance: "
+ "\n2\tWithdraw: "
+ "\n3\tDeposit: "
+ "\n4\tInformation: "
+ "\n5\tExit: \n");
sel = input.nextInt();
switch(sel)
{
case 1: a.getbalance();//getting acct bal
break;
//asking the user how much they would like to withdraw
case 2: System.out.println("\nHow much would you like to withdraw?\n");//asking for how much to be withdraw
amt = input.nextDouble();
if(amt>a.getbalance())
{
//letting the user know the amount they withdraw is not sufficient in the account
System.out.println("\nInsufficient funds.\n");//letting the user know there not enough funds
}
else
{
a.withdraw(amt);//letting the user know there is enough in the account
}
break;
//asking the user how much the user want to deposit
case 3: System.out.println("\nHow much would you like to deposit?\n");//ask how much to be deposited
amt = input.nextDouble();
a.deposit(amt);//getting the amount to be deposit
break;
case 4: a.toString();//acquiring the user information
break;
case 5: break;
}
}while(sel!=5);
}


