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
Problem Description: Problem Description: (The Account class) Design a class named Account that contains: A private...
Problem Description: Problem Description: (The Account class) Design a class named Account that contains: A private int data field named id for the account (default 0). A private double data field named balance for the account (default 0). A private double data field named annualInterestRate that stores the current interest rate (default 0). Assume all accounts have the same interest rate. A private Date data field named dateCreated that stores the date when the account was created. A no-arg constructor...
Create a class hierarchy to be used in a university setting. The classes are as follows:...
Create a class hierarchy to be used in a university setting. The classes are as follows:  The base class is Person. The class should have 3 data members: personID (integer), firstName(string), and lastName(string). The class should also have a static data member called nextID which is used to assign an ID number to each object created (personID). All data members must be private. Create the following member functions: o Accessor functions to allow access to first name and last...
Java program question! If I pass null to a method, how can I use the passed...
Java program question! If I pass null to a method, how can I use the passed value to compare. Here is example code, it might be wrong, please make it could run on eclipse. Public class hw{ public static void main (String args[]) { method1(); } private static void method1() { System.out.println(method(null)); } public static String method(int[] a) { return null; } What I want to get in the output is just "()". It is not just to type the...
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...
Question 3 a) Add a new class named CAS (Contract Academic Staff) to the project. It...
Question 3 a) Add a new class named CAS (Contract Academic Staff) to the project. It must inherit from Professor, but add a new String attribute named term. (The term must be a six digit string, with the year followed by two digits to represent the term: "01" for Winter, "05" for Spring, and "09" for Fall. Thus, 201705 represents the Spring 2017 term. Override print so that it prints CAS data like: McGarrity, Ivan Department: English Term: 201705 Write...
We encourage you to work in pairs for this challenge to create a Student class with...
We encourage you to work in pairs for this challenge to create a Student class with constructors. First, brainstorm in pairs to do the Object-Oriented Design for a Student class. What data should we store about Students? Come up with at least 4 different instance variables. What are the data types for the instance variables? Write a Student class below that has your 4 instance variables and write at least 3 different constructors: one that has no parameters and initializes...
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)...
Design a class that can be used to simulate rolling a multi-faced die. 2. Write a...
Design a class that can be used to simulate rolling a multi-faced die. 2. Write a Java class called Die in a class file called Die.java.    3. The Die class will have three private class attributes: a. The first attribute, called numSides, is of type int and represents the number of sides on the die. b. The second attribute, called sumRolls, is static of type int and will keep track of the sum of multiple die rolls by multiple...
JAVA ONLY - Complete the numbered comments import java.text.DecimalFormat; /** * Complete the code below the...
JAVA ONLY - Complete the numbered comments import java.text.DecimalFormat; /** * Complete the code below the numbered comments, 1 - 4. * Do not change the pre-written code * @author */ public class HouseListing { /* * 1. Create instance variables as shown in UML */ /* * default constructor (If an empty house object is created) * assigns listingNumber the text string 0000 * assigns houseDescription an empty text string * assigns listingPrice the value of 1.0 */ public...
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...