Wednesday, September 3, 2008

Client.java

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/

package bankaccount;

/**
*
* @author dfreer
*/
public class Client {
//Client properties
private String firstName;
private String lastName;
private double balance;
private int socialSecurity;

//methods for the Client
public String returnName()
{
return firstName + lastName;
}
public double getBalance(){
if(balance > 0)
return balance;
else
return -9999;
}

public void deposit(double amt)
{
balance = balance + amt;
}
//this is the constructor for the client object
public Client(String fn, String ln, double b, int ss){
firstName = fn;
lastName = ln;
balance = b;
socialSecurity = ss;
}

public static void main (String [] args)
{
Client ourFirstClient = new Client("Dwyane", "Wade", 6787456.24, 123456798);
//we make an object of Client for Dwyane Wade and return his balance
System.out.println(ourFirstClient.getBalance());
//6787456.24 is expected
ourFirstClient.deposit(1000000);
System.out.println(ourFirstClient.getBalance());
//boolean a = true;
//add to the constructor an address, preferred customer capability,
//add a method to withdraw money but do not let customer withdraw more than they
//have
}

}

No comments: