// A simple Applet to show how to use the Account class // Nancy McCracken 3/14/97 import java.awt.*; public class AccountTest extends java.applet.Applet { Font f = new Font("TimesRoman", Font.BOLD, 24); Account george; // variable for instance of Account class int x; // variables x and y control print placement int y; public void init() { // create a new instance of the Account class george = new Account ("George", 5000.F ); } public void paint(Graphics g) { String s; g.setFont(f); x = 25; y = 25; print(g, "George's initial balance is $" + george.getbalance()); // call an Account method on the instance george george.deposit(1500.F); print(g, "George deposits $1500."); s = george.withdraw(523.F); print(g, "George withdraws $523."); george.monthactivity(); print(g, "After one month, George's account has $" + george.getbalance()); } public void print(Graphics g, String s) { g.drawString (s, x, y); y += 30; } }