Develop a test plan for testing the bankloan class

Assignment Help JAVA Programming
Reference no: EM131018321

Tasks

Stage 1:

Start a new Java Project

Create a class named BankLoan which will represent information about a loan a person wants to get from the bank, to purchase a car, a house, or some other expensive item, and they will pay back gradually over time.

The BankLoan will have the following states (which the subsequent tasks will explain what you need to code), and will allow the described actions during each state:

- Application - in this state, the amount desired to be borrowed can be set and altered

- Assessment - in and after this state, the amount desired to be borrowed cannot be changed any more. In this state there can be disapprovals, i.e. reasons provided why the loan should not be permitted (e.g. because of bad credit ratings)

- Rejected - in this state, nothing more can be done to the BankLoan, you can only access the information about the application and subsequent rejection.

- Approved - in this state, you can take the money, or cancel by closing the loan.

- Paying Back - in this state, you cannot take any more money, but you can make payments back and have interest applied on the outstanding amount.

- Closed - once all the money owed has been paid, nothing more can be done to the BankLoan, you can only access the information about the historic facts.

1. Ensure the class contains definitions for the following attributes:

- The full name of the person applying for the loan
- A description of what they want the loan to be for (e.g. to buy a car)
- The amount the loan will be for. Note, the maximum loan that someone can apply for is
$10 million - so the data type must be appropriately chosen to allow for this.
- The amount which remains unpaid - over time this value will vary somewhere between the value of the previous attribute, and zero.
- A string for storing any ‘notes' about the loan (such as reasons for rejecting an application).
- An attribute to "know" what state the BankLoan is currently in, which can be assigned a value of one of the constants (see next task)

2. Ensure the class defines the following constants (i.e. using ‘final' in their declaration), to signify the different possible states of the object:
- APPLICATION
- ASSESSMENT
- REJECTED
- APPROVED
- PAYING_BACK
- CLOSED

3. Ensure there are accessors for all the attributes.

4. Ensure there is a constructor that accepts two String parameters (one for the applicant's name, one for the reason they want the loan), and ensure that the state of the object is set to be the Application state.

5. Ensure there is a mutator to allow adjustment of the amount that they are applying for. Be sure to include a check that the current state is the Application state, before accepting the parameter. (i.e. if the state is not currently the Application state, then do nothing except return false.) If the parameter is sensible, and the state is currently the Application state, then update the attribute to the new value and return true.

6. Include a method named ‘beginAssessment' which confirms that the current state is the Application state, and if so, changes the state to now be the Assessment state (otherwise, it does nothing except possibly to return false).

7. Provide a method named ‘rejectApplication' which should have a parameter for receiving a reason why the application is being rejected. The method should first confirm that the current state is the Assessment state (otherwise it should do nothing except possibly to return false). If it was currently in Assessment state, then it will set the note attribute to be the string that was given as the parameter, and will change the state to be Rejected.

8. Provide a method named ‘approveApplication' which confirms that the current state is the Assessment state (otherwise it should do nothing except possibly to return false). If it was in the Assessment state, then it should change to the Approved state.

9. Provide a method named ‘takeOutMoney' which requires a parameter to specify how much money is going to be taken out. If the amount specified in this parameter is equal to or less than the amount that had been approved for the loan, and if the object is currently in the Approved state, then the attribute for recording how much remains unpaid should be set to the value of the parameter, and the state should be changed to the Paying Back state. Otherwise the method should do nothing (except possibly to return false).

10. Provide a method named ‘makePayment' which requires a parameter to specify how much money is being paid back to the bank by the person who the loan is for. The method should check to confirm that the object is currently in the Paying Back state, and if the parameter amount is not more than a few cents of the amount that remains unpaid, then the value of the parameter should be subtracted from the amount that remains unpaid (e.g. if $10,000.99 remains due, a parameter of exactly 10001 should be acceptable, even though it is one cent more than the unpaid amount; but 10002 is too large to be acceptable).

11. Provide a method named ‘closeAccount' which is only valid in the following cases:

- The state is Approved, and no money has been taken out yet, or

- The state is Paying Back, and the amount owing (the amount unpaid) is less than $0.10

If one of those cases applies, then the method will change the state of the object to be Closed. (Otherwise it should do nothing except possibly to return false.)

12. Provide a method named ‘toString', which accepts no parameter but returns a String. The String returned should indicate that this is a BankLoan object, and which particular person it is for. It should also indicate the current state of the object. If known/relevant it should also indicate: the amount that was approved for the loan; the amount that is currently unpaid (owed).

Stage 2: Test Planning

13. Develop a test plan for testing the BankLoan class. This means, write up a set of test cases to adequately test that the BankLoan class is behaving correctly. Follow the format that is provided in the supplementary guide about testing, on Moodle.

Stage 3: Code a Test Driver

14. Write a class containing a main() method, which will effectively execute (automatically) the test cases of your test plan. In comments, indicate which test case is being tested at each section of the main() method's code.

Reference no: EM131018321

Questions Cloud

What are the benefits of state support for religion : What are the benefits of state support for religion - How do we see state aid evolve into the medieval period?
Describe a biofeedback program for stress management : Describe a biofeedback program for "stress management." Include details such as the physiological variables you would measure, the transducers needed, and your criterion for a successful training program.
Blue-black when brought in contact with iodine : Which food stuff turns blue-black when brought in contact with iodine?
Describe the security vulnerabilities of web applications : Describe the advantages and challenges of using a client / server architecture for applications in a Web environment. Give a real-world example of each environment. Describe the security vulnerabilities of Web applications, such as banking on the..
Develop a test plan for testing the bankloan class : Create a class named BankLoan which will represent information about a loan a person wants to get from the bank, to purchase a car, a house, or some other expensive item, and they will pay back gradually over time.
What is the pulse rate of an average healthy human being : What is the pulse rate of an average healthy human being?
Describe the primary types of traffic that it may contain : A converged network is one in which the data, voice, and video traffic coexist on a single network." Identify one (1) real-world converged network and describe the primary types of traffic that it may contain.
What is the variable cost of producing this level of output : Suppose this firm produces 15 units of output. What is the variable cost of producing this level of output? What is the firm's AVC of production when it produces 15 units of output. Explain your answer fully
How many liters of milk a baby blue whale drinks a day : How many liters of milk a baby blue whale drinks a day?

Reviews

Write a Review

JAVA Programming Questions & Answers

  Exception handling

Write a java program to Facilitates keyboard input by abstracting details about input parsing, conversions, and exception handling.

  Create java application which creates random phone number

Create and implement Java application which creates and prints a random phone number of the form xxx-xxx-xxxx. Include the dashes in the output.

  Allows the user to enter a temperature and whether

Write a program that allows the user to enter a temperature and whether the temperature is stated in Celsius or Fahrenheit...or whethe

  Program that uses random instead of scanner to play

Write a Java Program that uses Random instead of Scanner to play many rounds of Rock Paper Scissors. The user and computer will each randomly pick one and common rules of winning apply

  Explain tostring methods in java

Add an instance variable, named department, of type String. Supply a method toString that prints the manager's name,department, and salary. Make a class Executive inherit from Manager.

  Calculation or a calendar of some activity.

1. Provide Java code for a simple class of your choice. Be sure to include at least one constructor, two methods and two fields. The fields should be private.Create a test class to construct and call the methods of your class. Describe your class and..

  Show all the objects that are common to both lists

Prepare the segment of code assuming that the objects are of type String and

  Leadership position in a hospital emergency room

Identify in a leadership position in a hospital emergency room. Evaluate how  organization handles patient and employee education, and whether that organization participates in any research (if so, find out what types and whether it is mostly qualita..

  Prepare a program that constructs a binary tree

Write your own implementation of primitive operations and use self-referential classes in your implementation.

  It inherits the functionality of super class

It inherits the functionality of super class Package and contains an additional data member representing an additional fee per ounce charged for overnight-delivery service.

  Java program that will prompt the user to input a file

Write a Java program that will prompt the user to input a file (document) in order to count the frequency of each word. This program will display the frequency of each word sorted alphabetically or by frequency (depending on the preference of the use..

  Write down a java program which prints out all 92 solutions

write a java program which prints out all 92 solutions of the 8-queen problem but modify the program to display only

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd