50 likes | 124 Views
Project Part 1. Transaction List, error checking & aggregation. Last time we created a BankAccount class:. Fields to store: C urrent balance Account number Customer name
E N D
Project Part 1 Transaction List, error checking & aggregation
Last time we created a BankAccount class: • Fields to store: • Current balance • Account number • Customer name • Customer address* Think about what types these should be. For example, should the account number actually be stored as a number? What about leading 0’s? • Write a constructor that takes the customer’s name, address, and account number, and initializes the balance to 0. • Write getter and setter methods for the name and address fields. • Write a deposit and a debit method.The method signatures are similar in that there is no return value and one parameter. Created by Emily Hill & Jerry Alan Fails
And we tested BankAccount in main: • Write a print method that prints out the account information, including the current balance. Make sure to use proper formatting so both dollars and cents are displayed correctly. This method should take no parameters and return nothing. • Write a main method that creates a new, empty BankAccount stored in local variable myBankAccount. • Deposit $5.00 into your BankAccount & print the balance • Debit $1.50 into your BankAccount & print the balance • Before submitting you were told to be sure your BankAccount has the following methods: • 1 constructor only (not 2) that takes 3 parameters • getCustomerName, getCustomerAddress, getAccountNumber • setCustomerName, setCustomerAddress • deposit, debit, print, main Created by Emily Hill & Jerry Alan Fails
For the Part 1 of the Project • Update debit to check the balance before deducting • Update debit & deposit to only work with positive values • Create new deposit and debit methods that also take a String description as a parameter • Add a Transaction class too keep track of all deposits and debits (See next page for information on the Transaction class and the enumerated type that you need to use) Created by Emily Hill & Jerry Alan Fails
Adding a Transaction class Create a Transaction class & enumerated type:* You can use Eclipse’s source code generation to create getters and setters for the fields