Question

loanCreator.java: /* * Use constants when necessary, define with proper scope * * Create Person class...

loanCreator.java:

/*
* Use constants when necessary, define with proper scope
*
* Create Person class with data fields of firstName and lastName these fields can not change.
*
* Create Loan class with data fields of Person, loan Amount, term and interest rate
* If term is not past in then default value is 36
* If interest is not past in then default value is 5.0
*
* In Loan class create method to construct output String
*
* The loan for: Fred Wasup
* The loan amount is 20000
* The term is 60
* The interest rate is %6.5
*/

package edu.hfcc;

public class LoanCreator {
  
  
  
   public String execute(String firstName, String lastName, int loanAmount, Integer term, Double interestRate) {
      
       String output = "";
      
       if (term == null && interestRate == null) {
           //Construct Loan class with constructor for Person and Loan Amount
           //Assign output to method created in Loan class constructing output string
       } else if (term == null && interestRate != null) {
           //Construct Loan class with constructor for Person and Loan Amount And Interest
           //Assign output to method created in Loan class constructing output string
       } else if (term != null && interestRate == null) {
           //Construct Loan class with constructor for Person and Loan Amount And term
           //Assign output to method created in Loan class constructing output string
       } else {
           //Construct Loan class with constructor for Person and Loan Amount And term and interest rate
           //Assign output to method created in Loan class constructing output string
       }
      
       return output;
   }

  

}

LoanCreatorApp.java:

/*
* This app will print to console the first and last name of person getting a loan and loan amount based upon value passed in
*
* The value for term and interest rate will print if value passed in
* If no value for term then the default value of 36 will be used otherwise the value passed in will be printed
* If no value for interest rate then the default value of 5.0 willl be used otherwise the value passwed in will be printed
*
* DO NOT CHANGE THIS FILE
*
* REMEMBER TO RUN TEST TO VERIFY OUTPUT
*
* Under src/main/test you will see CalculateAreaTest
* Right click on the file and you will see Run As
* Click Run As and you will see JUnit Test
* Click JUnit Test and you will the test and see if you are GREEN or RED
*/
package edu.hfcc;

public class LoanCreatorApp {
  

public static void main(String[] args) {
  
LoanCreator loanCreator = new LoanCreator();

System.out.println("All parameters passed");
System.out.println(loanCreator.execute("Fred", "Wasup", 25000, 48, 6.2));

System.out.println("Only necessary parameters using default values");
System.out.println(loanCreator.execute("Fred", "Wasup", 25000, null, null));

System.out.println("Passing needed parameters and term , using default interest rate");
System.out.println(loanCreator.execute("Fred", "Wasup", 25000, 60, null));

System.out.println("Passing needed parameters and interest rate , using default term");
System.out.println(loanCreator.execute("Fred", "Wasup", 25000, null, 3.3));

}
}

Homework Answers

Answer #1

Please find the answer below:-

Loan.java



Person.java

LoanCreator.java

LoanCreatorApp.java

Output :-

Thanks.

Hope you like the answer.

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Attached is the file GeometricObject.java. Include this in your project, but do not change. Create a...
Attached is the file GeometricObject.java. Include this in your project, but do not change. Create a class named Triangle that extends GeometricObject. The class contains: Three double fields named side1, side2, and side3 with default values = 1.0. These denote the three sides of the triangle A no-arg constructor that creates a default triangle A constructor that creates a triangle with parameters specified for side1, side2, and side3. An accessor method for each side. (No mutator methods for the sides)...
For this assignment, you'll create a Player class that captures information about players on a sports...
For this assignment, you'll create a Player class that captures information about players on a sports team. We'll keep it generic for this assignment, but taking what you learn with this assignment, you could create a class tailored to your favorite sport. Then, imagine using such a class to track the stats during a game. Player Class Requirements Your class should bet set up as follows: Named Player Is public to allow access from other object and assemblies Has a...
in jGRASP INVENTORY CLASS You need to create an Inventory class containing the private data fields,...
in jGRASP INVENTORY CLASS You need to create an Inventory class containing the private data fields, as well as the methods for the Inventory class (object). Be sure your Inventory class defines the private data fields, at least one constructor, accessor and mutator methods, method overloading (to handle the data coming into the Inventory class as either a String and/or int/float), as well as all of the methods (methods to calculate) to manipulate the Inventory class (object). The data fields...
TrackMinMax For this lab, you will create a generic version of the IntTrackMinMax class you wrote...
TrackMinMax For this lab, you will create a generic version of the IntTrackMinMax class you wrote in a previous lab, called TrackMinMax. The API is: Function Signature Description constructor TrackMinMax() constructor check void check(T i) compares i to the current minimum and maximum values and updates them accordingly getMin T getMin() returns the minimum value provided to check() so far getMax T getMax() returns the maximum value provided to check() so far toString String toString() returns the string "[min,max]" As...
Using Java language.... Polymorphism of Interfaces : Take the Account class from the last chapter and...
Using Java language.... Polymorphism of Interfaces : Take the Account class from the last chapter and make a java program for your bank. However, there is another type of customer that may not have money in the bank and may not in fact have a back account with this bank at all, but may have a loan here. Make another class in the application you are making called CarLoan. Carloan's should have a name, amount owed, a rate, and a...
1) Consider the following Java program, which one of the following best describes "setFlavor"? public class...
1) Consider the following Java program, which one of the following best describes "setFlavor"? public class Food {     static int count;     private String flavor = "sweet";     Food() { count++; }     void setFlavor(String s) { flavor = s; }     String getFlavor() { return flavor; }     static public void main(String[] args) {         Food pepper = new Food();         System.out.println(pepper.getFlavor());     } } a. a class variable b. a constructor c. a local object variable d....
My assignment: Triplet Template Class Directions: Define a template class for a generic triplet. The private...
My assignment: Triplet Template Class Directions: Define a template class for a generic triplet. The private data member for the triplet is a generic array with three elements. The triplet ADT has the following functions:  default constructor  explicit constructor: initialize the data member using parameters  three accessors (three get functions) which will return the value of each individual element of the array data member  one mutator (set function) which will assign values to the data member...
Cpp Task: Create a class called Mixed. Objects of type Mixed will store and manage rational...
Cpp Task: Create a class called Mixed. Objects of type Mixed will store and manage rational numbers in a mixed number format (integer part and a fraction part). Details and Requirements Your class must allow for storage of rational numbers in a mixed number format. Remember that a mixed number consists of an integer part and a fraction part (like 3 1/2 – “three and one-half”). The Mixed class must allow for both positive and negative mixed number values. A...
IntNode class I am providing the IntNode class you are required to use. Place this class...
IntNode class I am providing the IntNode class you are required to use. Place this class definition within the IntList.h file exactly as is. Make sure you place it above the definition of your IntList class. Notice that you will not code an implementation file for the IntNode class. The IntNode constructor has been defined inline (within the class declaration). Do not write any other functions for the IntNode class. Use as is. struct IntNode { int data; IntNode *next;...
NEED: VBA Subroutine Pls, do not use Class Exmp: Sub FutureAccountValue() Dim Deposit As Single Dim...
NEED: VBA Subroutine Pls, do not use Class Exmp: Sub FutureAccountValue() Dim Deposit As Single Dim AddContribution As Single Dim Years As Single Dim InterestRate As Single ..... // Sub 1) Write a subroutine that asks the user for: The deposit Amount The additional contribution (deposit) each year The number of Years The interest Rate (APR) Then, display the future value of the user’s account each year for some number of years. Also show the growth from the original investment...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT