cscie160.hw4
Class ATMProxy
java.lang.Object
|
+--cscie160.hw4.ATMProxy
- All Implemented Interfaces:
- ATM
- public class ATMProxy
- extends java.lang.Object
- implements ATM
Constructor Summary |
ATMProxy(java.lang.String mHost,
int mPort)
|
Constructor. |
Method Summary |
void |
cleanUp()
|
Cleanup sockets and file IO used by this client. |
void |
deposit(float amount)
|
Sends a network call to the server asking it to
deposit [amount] into the account. |
float |
getBalance()
|
Sends a network call to the server requesting the
balance of the account |
static float |
stringToFloat(java.lang.String stringObject)
|
Converts a string to a float. |
void |
withdraw(float amount)
|
Sends a network call to the server, asking it to
withdraw [amount] from the account |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ATMProxy
public ATMProxy(java.lang.String mHost,
int mPort)
- |
Constructor.
- Parameters:
String
- The "host" location of the server.int
- The port used by the server.
deposit
public void deposit(float amount)
throws ATMException
- |
Sends a network call to the server asking it to
deposit [amount] into the account.
- Specified by:
deposit
in interface ATM
- Parameters:
float
- Amount to be deposited.
withdraw
public void withdraw(float amount)
throws ATMException
- |
Sends a network call to the server, asking it to
withdraw [amount] from the account
- Specified by:
withdraw
in interface ATM
- Parameters:
float
- Amount to be withdraw
getBalance
public float getBalance()
throws ATMException
- |
Sends a network call to the server requesting the
balance of the account
- Specified by:
getBalance
in interface ATM
- Returns:
- float The balance returned by the server.
cleanUp
public void cleanUp()
- |
Cleanup sockets and file IO used by this client.
stringToFloat
public static float stringToFloat(java.lang.String stringObject)
- |
Converts a string to a float.
- Parameters:
String
- The string to convert.- Returns:
- float A float representation of the given string.