Intro to Java: Instance variables Assigment

Anonymous
timer Asked: Feb 4th, 2019
account_balance_wallet $15

Question Description

For this assignment, you are expected to infer some of the requirements from the unit tests. This includes string formats, exact names of methods, the order or arguments and the constructors required.

Create a Customer class with the following:

1. Instance variables with appropriate getter and setter methods: name, which is a String, and a customerID, which is an integer.

2. A toString() method which provides a well-formatted string representation of the instance variables in the Customer class.

3. Appropriate constructors for the class.

Update BankAccount class to:

1. Add an instance of the Customer class to your BankAccount class as an instance variable with a getter and setter method. The name of the instance variable should be accountHolder.

2. Add appropriate constructors to allow creation of bank accounts to specify an account holder.

3. Update the toString method such that the string returned includes account holder information.

4. Add a method called transfer that takes an amount to transfer and an account to transfer to as arguments. The transfer should only take place if the account has enough funds.

A JUnit test is provided below for both the updated BankAccount class (20 tests) and the Customer class (5 tests). To qualify for the full team grade you must pass at least 20/25 tests.

Run JUnit test!! to check the work.

Use JUnit Test to test the code. (When it's run, it should say that there are no errors/failures)

  1. Create a new folder.
  2. Put junit-4.12.jar and hamcrest-core-1.3.jar in this folder (available below).
  3. Copy the test code with possible supporting files in this same folder.
  4. Create the file with code as required.
  5. Compile your code and the test code using the command javac -cp .;junit-4.12.jar:hamcrest-core-1.3.jar *.java
  6. Run the test using the command "java -cp .;junit-4.12.jar:hamcrest-core-1.3.jar org.junit.runner.JUnitCore BankAccountIA3Test" and "java -cp .;junit-4.12.jar:hamcrest-core-1.3.jar org.junit.runner.JUnitCore CustomerIA3Test"

Take a screenshot of cmd to show that file is working properly. If you need more information leave a question and I'll try to answer them ASAP. Thank you.

Unformatted Attachment Preview

Tutor Answer

criss53
School: Rice University

At...

flag Report DMCA
Review

Anonymous
Tutor went the extra mile to help me with this essay. Citations were a bit shaky but I appreciated how well he handled APA styles and how ok he was to change them even though I didnt specify. Got a B+ which is believable and acceptable.

Similar Questions
Hot Questions
Related Tags
Study Guides

Brown University





1271 Tutors

California Institute of Technology




2131 Tutors

Carnegie Mellon University




982 Tutors

Columbia University





1256 Tutors

Dartmouth University





2113 Tutors

Emory University





2279 Tutors

Harvard University





599 Tutors

Massachusetts Institute of Technology



2319 Tutors

New York University





1645 Tutors

Notre Dam University





1911 Tutors

Oklahoma University





2122 Tutors

Pennsylvania State University





932 Tutors

Princeton University





1211 Tutors

Stanford University





983 Tutors

University of California





1282 Tutors

Oxford University





123 Tutors

Yale University





2325 Tutors