1 / 5

Project Part 1

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

hakan
Télécharger la présentation

Project Part 1

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Project Part 1 Transaction List, error checking & aggregation

  2. 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

  3. 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

  4. 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

  5. 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

More Related