// This class demonstrates the use of data declarations and methods. // A bank account with an account number and balance is declared. public class BankAccount { // Declare instance variables int acctNumber; // Account number stored in integer double acctBalance; // Account balance stored in double precision // Declare methods. public static void main (String[] args) { // Create accounts for Kate and Sawyer, initialize them and print them out // Note that the following creates two objects BankAccount KateAcct = new BankAccount(); BankAccount SawyerAcct = new BankAccount(); KateAcct.setAcctNumber(481516); KateAcct.setAcctBalance(108.00); SawyerAcct.setAcctNumber(2342); SawyerAcct.setAcctBalance(1980.2004); KateAcct.printAcctBalance(); SawyerAcct.printAcctBalance(); } // Prints out the account balance void printAcctBalance() { System.out.println("The balance of the account " + acctNumber + " is " + acctBalance); } // Prints out the account number void printAcctNumber() { System.out.println("This account number is " + acctNumber); } // Set the account balance void setAcctBalance(double balance) { acctBalance = balance; } // Set the Account number void setAcctNumber(int number) { acctNumber = number; } }