package bank.vip.or.np;
import java.util.Scanner;
public class BankVipOrNp {
public static void main(String[] args) {
// this is a programm for a bank to determine whether the customer is vip or np
Scanner input = new Scanner (System.in);
double [] balance = new double[100];
for (int i=0;i<balance.length;i ){
System.out.println("enter the balance for customer no" (i 1));
balance[i]=input.nextDouble();
}
for (int i=0;i<balance.length;i ){
if( balance >= 1000000){
System.out.println("the customer is vip" balance);
}
else {
System.out.println("the customer is np" balance);}
}
}
}
CodePudding user response:
balance
is an array.
Writing balance >= 1000000
makes no sense as you are comparing an int with an array. You are not comparing a value of the table, but the whole table.
Instead use:
if(balance[i] >= 1000000){