/* File: Account.java * Author: Matt Faulkner * Due Date: 16 JUL 2007 * Class: CMIS 141 * Instructor: Dr. Yuan * Problem: Design a constructor with the included elements below * Purpose: Week 7 Discussion exercise * Status: Complete * History: * 7/15/07 - Start constructor class * 7/15/07 - Class complete **/ public class Account { private String accountName; private String accountOwner; private double accountBalance; private double withdrawl; private double deposit; //Account(): default constructor public Account() { accountOwner = ""; accountName = ""; accountBalance = 0; } //Account(): specific constructor // Configures a new account with name s, owner t, and balance n. private Account(String s, String t, double n) { accountName = s; accountOwner = t; accountBalance = n; } //zeroes account and resets owner public void close() { accountBalance = 0; accountOwner =""; } // deposit(): deposit mutator public void deposit(double n) { accountBalance += n; } //withdrawl(): withdrawl mutator public void withdrawl(double n) { accountBalance -= n; } //getBalance(): account Balance accessor public double getBalance() { return accountBalance; } //setOwner(): Owner mutator public void setOwner(String s) { String accountOwner = s; } //getOwner: owner accessor public String getOwner() { return accountOwner; } //setName(): name mutator private void setName(String s) { accountName = s; } //getAccountName(): name accessor public String getAccountName() { return accountName; } //returns a string with all account information. public String toString() { return (accountName + "\n" + accountOwner + "\n" + accountBalance); } }//end Account class