Presentation is loading. Please wait.

Presentation is loading. Please wait.

Objects First with Java Transaction List, error checking & aggregation

Similar presentations


Presentation on theme: "Objects First with Java Transaction List, error checking & aggregation"— Presentation transcript:

1 Objects First with Java Transaction List, error checking & aggregation
Project Part 1 Transaction List, error checking & aggregation Replace this with your course title and your name/contact details. © David J. Barnes and Michael Kölling

2 Last time we created a BankAccount class: (This was done)
Objects First with Java Last time we created a BankAccount class: (This was done) 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. Get method for the Account number. 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 © David J. Barnes and Michael Kölling

3 And we tested BankAccount in main:
Objects First with Java 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 © David J. Barnes and Michael Kölling

4 For the Part 1 of the Project
Objects First with Java 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 © David J. Barnes and Michael Kölling

5 Adding a Transaction class
Objects First with Java 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 © David J. Barnes and Michael Kölling

6 Submitting your project
Objects First with Java Submitting your project Be sure that you include a Transaction in your BankAccount, and that the program run using the main method. When you think you are done: Save your project with the name Part1_netID, by exporting it, and upload it to Canvas. © David J. Barnes and Michael Kölling


Download ppt "Objects First with Java Transaction List, error checking & aggregation"

Similar presentations


Ads by Google