Follow
Publications: 0 | Followers: 0

Objects First With Java - Chapter 1

Publish on Category: Birds 268

ProjectPart 1
Transaction List, error checking & aggregation
Last time we created aBankAccountclass: (This was done)
Fields to store:Current balanceAccount numberCustomer nameCustomer 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 debitmethod.Themethod signatures are similar in that there isno return valueandone parameter.
Created by Emily Hill & Jerry Alan Fails
And we testedBankAccountin 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, emptyBankAccountstored in local variablemyBankAccount.Deposit $5.00 into yourBankAccount& print the balanceDebit $1.50 into yourBankAccount& print thebalanceBefore submitting you were told to be sure yourBankAccounthas the following methods:1 constructor only (not 2) that takes 3 parametersgetCustomerName,getCustomerAddress,getAccountNumbersetCustomerName,setCustomerAddressdeposit, debit, print, main
Created by Emily Hill & Jerry Alan Fails
For the Part 1 of the Project
Update debit to check the balance before deductingUpdate debit & deposit to only work with positive valuesCreate new deposit and debit methods that also take a String description as a parameterAdd a Transaction class too keep track of all deposits anddebits (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
Submitting your project
Be sure that you include a Transaction in yourBankAccount, and that the program run using the main method.When you think you are done:Save yourproject with the namePart1_netID, by exporting it, and upload ittoCanvas.

0

Embed

Share

Upload

Make amazing presentation for free
Objects First With Java - Chapter 1