Thanks Sanchez Construction Loan Co makes loans of up to 100

Thanks!

Sanchez Construction Loan Co. makes loans of up to $100,000 for construction projects. There are two categories of Loans-those to businesses and those to individual applicants. Write an application that tracks all new construction loans. The application must also calculate the total amount owed at the due date (original loan amount + loan fee). The application should Include the following classes: Loan-A public abstract class that Implements the Loan Constants Interface. A Loan Includes a loan number, customer last name, amount of loan, Interest rate, and term. The constructor requires data for each of the fields except Interest rate. Do not allow loan amounts over $100,000. Force any loan term that is not one of the three defined in the Loan Constants class to a short-term. 1-year loan. Create gets and sets for all the Instance fields and a toStrlng() method that displays all the loan data. Loan Constants-A public Interface class. Loan Constants Includes constant values for short-term (1 year), medium-term (3 years), and long-term (5 years) loans. It also contains constants for the company name and the maximum loan amount. Business Loan-A public class that extends Loan. The Business Loan constructor sets the Interest rate to 1 percent over the current prime Interest rate. Personal Loan-A public class that extends Loan. The Personal Loan constructor sets the Interest rate to 2 percent over the current prime Interest rate. Create Loans-An application that creates an array of five Loans. Prompt the user for the current prime Interest rate. Then, In a loop, prompt the user for a loan type and all relevant Information for that loan. Store the created Loan Objects In the array. When data entry is complete, display all the loans. Save the files as Loan.java, LoanConstants.java, BusinessLoan.java, PersonalLoan.java. and CreateLoans.java.

Solution

CreateLoans

package createloans;

import java.util.Scanner;


public class CreateLoans {

public static void main(String[] args) {

int x = 0;

int primeRate;

String type;

Scanner input = new Scanner(System.in);

Loan[] loans = new Loan[5];

System.out.println(\"Enter the prime interest rate\");

primeRate = input.nextInt();
primeRate = primeRate/100;

input.nextLine();

for(x = 0; x < 6; ++x) {

System.out.println(\"Please enter a loan type as Business or or Personal Loan \");

type = input.nextLine();

if (type.equalsIgnoreCase(\"Business\")) {

System.out.println(\"What is the account number on the loan?\");

int ln = input.nextInt();

System.out.println(\"What is the last name on the account?\");

String last = input.nextLine();

input.nextLine();

System.out.println(\"What is the loan amount? \");

int la = input.nextInt();

System.out.println(\"The term of account is ___________.\");

int term = input.nextInt();

loans[x] = new BusinessLoan(ln, last, la, term);

System.out.println(\" Company\'s Name is \" + Loan.COMPANY_NAME);

System.out.println(\" loan number is \" + loans[x].getLoanNumber());

System.out.println(\"The last name on the loan is \" + loans[x].getLastName());

System.out.println(\"The loan amount is \" + loans[x].getLoanAmount());

System.out.println(\"The interest rate on the loan is \" + loans[x].getInterestRate());

System.out.println(\"The term on the account is \" + loans[x].getTerm());

}

else if (type.equalsIgnoreCase(\"Personal\")) {

System.out.println(\"What is the account number on the loan?\");

int ln = input.nextInt();

System.out.println(\"What is the last name on the account?\");

String last = input.nextLine();

input.nextLine();

System.out.println(\"What is the loan amount?\");

int la = input.nextInt();

System.out.println(\"What is the term on the account? .\");

int term = input.nextInt();

loans[x] = new PersonLoan(ln, last, la, term);

System.out.println(\"The Company\'s Name is \" + Loan.COMPANY_NAME);

System.out.println(\"The loan number is \" + loans[x].getLoanNumber());

System.out.println(\"The last name on the loan is \" + loans[x].getLastName());

System.out.println(\"The loan amount is \" + loans[x].getLoanAmount());

System.out.println(\"The interest rate on the loan is \" + loans[x].getInterestRate());

System.out.println(\"The term on the account is \" + loans[x].getTerm());

} else {

System.out.println(\"You\'ve entered an invalid type Try again \");

System.exit(0);

}

}

}

LoanConstants

public class LoanConstants {

public interface LoanConstant {

public final static int SHORT_TERM = 1;

public final static int MEDIUM_TERM = 3;

public final static int LONG_TERM = 5;

public final static String COMPANY_NAME = \"Sanchez Construction\";

public final static int MAX_LOAN_AMOUNT = 100000;

}

}

Loan

public class Loan implements LoanConstant{

public static int loanNumber;

public static String lastName;

public static int loanAmount;

public static int interestRate;

public static int term;

public int primeRate;

public int getLoanNumber() {return loanNumber;}

public void setLoanNumber(int n){n = loanNumber;}

public String getLastName(){return lastName;}

public void setLastName(String s){s= lastName;}

public int getLoanAmount() {return loanAmount;}

public void setLoanAmount(int n){

n = loanAmount;

if (term == 1){

term = SHORT_TERM;}

else if (term == 3){

} else if (term == 3) {

term = MEDIUM_TERM;

} else if(term == 5) {

term = LONG_TERM;

} else

term = SHORT_TERM;

}

public int getInterestRate() {return interestRate;}

public void setInterestRate(int i){i = interestRate;}


public static void displayAll(){

System.out.println(\"The Company\'s Name is \" + COMPANY_NAME);

System.out.println(\"The loan number is \" + loanNumber);

System.out.println(\"The last name on the loan is \" + lastName);

System.out.println(\"The loan amount is \" + loanAmount);

System.out.println(\"The interest rate on the loan is \" + interestRate);

System.out.println(\"The term on the account is \" + term);

}

}

BusinessLoan

public class BusinessLoan extends Loan{

public BusinessLoan(int ln, String last, int la, int term) {

setLoanNumber(ln);

setLastName(last);

setLoanAmount(la);

setTerm(term);

interestRate = (int)((primeRate * 0.01) + primeRate);
setInterestRate(interestRate);

}

PersonalLoan

public class PersonalLoan extends Loan {

public PersonalLoan(int ln, String last, int la, int term) {

setLoanNumber(ln);

setLastName(last);

setLoanAmount(la);

setTerm(term);

interestRate = (int)((primeRate * 0.02) + primeRate);

setInterestRate(interestRate);

}

}

Thanks! Sanchez Construction Loan Co. makes loans of up to $100,000 for construction projects. There are two categories of Loans-those to businesses and those t
Thanks! Sanchez Construction Loan Co. makes loans of up to $100,000 for construction projects. There are two categories of Loans-those to businesses and those t
Thanks! Sanchez Construction Loan Co. makes loans of up to $100,000 for construction projects. There are two categories of Loans-those to businesses and those t
Thanks! Sanchez Construction Loan Co. makes loans of up to $100,000 for construction projects. There are two categories of Loans-those to businesses and those t
Thanks! Sanchez Construction Loan Co. makes loans of up to $100,000 for construction projects. There are two categories of Loans-those to businesses and those t

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site