29.07.2013 Views

Master of Science thesis Fighting Spam

Master of Science thesis Fighting Spam

Master of Science thesis Fighting Spam

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

System.out.println("withdrawFromUpFront 20.0 from Bents account");<br />

System.out.println(accounts.toString());<br />

/*<br />

try<br />

{<br />

PASTE IN THE CES !!!!!!!!!!!!!!!!!!!!!!!!!!!!<br />

acc.withdrawFromUpFront(amount);<br />

}<br />

catch(Exception ex)<br />

{<br />

String error = "The client could pay for the coins. Terminating! (..not<br />

the client...just the connection). "+ex.getMessage();<br />

Debugger.debug(getClass(), 1,error);<br />

throw new Exception(error);<br />

}<br />

*/<br />

}<br />

catch(Exception ex)<br />

{<br />

}<br />

}<br />

}<br />

10.4.5.b BankAccount<br />

package <strong>Spam</strong>Cash.Servers.CES;<br />

import java.security.cert.Certificate;<br />

import java.util.Vector;<br />

public class BankAccount<br />

{<br />

public String username;<br />

public String password;<br />

public double balance;<br />

public double paidUpFront;<br />

public Certificate cert;<br />

public Vector activationNumbers;<br />

public BankAccount(String username, String password, double balance)<br />

{<br />

this.username = username;<br />

this.password = password;<br />

this.balance = balance;<br />

activationNumbers = new Vector();<br />

}<br />

public void deposit(double amount) throws Exception<br />

{<br />

if(amount >= 0)<br />

balance += amount;<br />

else<br />

throw new Exception("BankAccount: Cannot deposit a negative amount!<br />

("+amount+")");<br />

}<br />

public void withdraw(double amt) throws Exception<br />

{<br />

if(amt

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!