Latest Tutorials| Questions and Answers|Ask Questions?|Site Map

Home Answers Viewqa Java-Beginners i need to print customer[1] is abcd,cbnb using array

Have Programming Question? Ask it here!

i need to print customer[1] is abcd,cbnb using array
0 Answer(s)      2 years and 8 months ago
Posted in : Java Beginners

print("code sample");

package bankprj3;

class Account { private double Balance;

public Account(double initBalance){ Balance=initBalance; } public double getBalance(){ return Balance; } public boolean deposit(double amt){ Balance=Balance+amt; return true; } public boolean withdraw(double amt){ if(Balance>=amt){ Balance=Balance-amt; return true; } else return false; } }

class Customer { public String firstname; public String lastname; private Account account; Customer(String f,String l){ firstname=f; lastname=l; } String getfirstname(){ return firstname;

 String getlastname(){
     return lastname;

 Account getAccount(){
     return account;

 void setAccount(Account acct){

} class Bank { public Customer customers[]; private int noofcustomers; Bank() {

      customers=new Customer[10];

 public void addCustomer(String f,String l) {
      int i=noofcustomers++;
     customers[i]=new Customer(f,l);

 public int getnoofcustomers(){
     return noofcustomers;
 public Customer getcustomer(int customer_index) {
     return customers[customer_index];

} public class Main {

public static void main(String[] args) {
    Bank b=new Bank();

   System.out.println( b.getnoofcustomers());
   System.out.println( b.getnoofcustomers());
  for(int i=0;i<5;i++)



View Answers

Related Tutorials/Questions & Answers: