// Scott DeRuiter 6/28/2002 // Checking.java // Set up a checking account class to be used by clients. public class Checking { private double balance; private double irate; private long accountnum; private String name; public Checking ( double b, double i, long acc, String n ) { balance = b; irate = i; accountnum = acc; name = n; } public void PrintInfo ( ) { System.out.println ( "\n\nHello, " + name + ", here is your account info: " ); System.out.println ( "Account Number: " + accountnum ); System.out.println ( "Interest Rate: " + irate ); System.out.println ( "\nCurrent Balance: " + balance + "\n\n" ); } public void Deposit ( double d ) { balance += d; } public void WithDrawal ( double w ) { balance -= w; } public void CleanOut ( ) { balance = 0; } public double SendBalance ( ) { return balance; } } // Scott DeRuiter 6/28/2002 // UseChecking.java // Create some checking accounts and use them. public class UseChecking { public static void main ( String [] args ) { Checking myaccount = new Checking ( 100.56, 0.02, 12398764, "Hugo Boss" ); myaccount.PrintInfo ( ); myaccount.Deposit ( 350.0 ); myaccount.PrintInfo ( ); myaccount.WithDrawal ( 260.25 ); myaccount.PrintInfo ( ); myaccount.CleanOut ( ); myaccount.PrintInfo ( ); double bal = myaccount.SendBalance ( ); System.out.println ( "\n\n Final Balance = " + bal ); } }