0% found this document useful (0 votes)
4 views4 pages

Java Loan and Borrower Classes

The document defines two Java classes, Borrower and Loan, for a mini loan application. The Borrower class includes attributes for the borrower's name, credit score, and yearly income, while the Loan class includes attributes for loan amount, duration, yearly interest rate, and approval status. Both classes utilize JAXB annotations for XML binding and include methods for accessing and modifying their attributes.

Uploaded by

ahmadziyad0807
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views4 pages

Java Loan and Borrower Classes

The document defines two Java classes, Borrower and Loan, for a mini loan application. The Borrower class includes attributes for the borrower's name, credit score, and yearly income, while the Loan class includes attributes for loan amount, duration, yearly interest rate, and approval status. Both classes utilize JAXB annotations for XML binding and include methods for accessing and modifying their attributes.

Uploaded by

ahmadziyad0807
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

package miniloan;

import [Link];
import [Link];
import [Link];
import [Link];

@XmlAccessorType([Link])
public class Borrower {
@XmlElement
private String name;
@XmlElement
private int creditScore;
@XmlElement
private int yearlyIncome;

public Borrower() {
}

public Borrower(@BusinessName("name") String name, @BusinessName("creditScore")


int creditScore, @BusinessName("yearlyIncome") int yearlyIncome) {
this();
[Link] = name;
[Link] = creditScore;
[Link] = yearlyIncome;
}

public String getName() {


return [Link];
}

public void setName(String n) {


[Link] = n;
}

public int getCreditScore() {


return [Link];
}

public void setCreditScore(int creditScore) {


[Link] = creditScore;
}

public int getYearlyIncome() {


return [Link];
}

public void setYearlyIncome(int yearlyIncome) {


[Link] = yearlyIncome;
}
}
package miniloan;

import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];

@XmlAccessorType([Link])
public class Loan {
@XmlElement
private int amount;
@XmlElement
private int duration;
private double yearlyInterestRate;
private int yearlyRepayment;
private boolean approved;
private Collection<String> messages;

public Loan() {
[Link] = new ArrayList();
[Link] = true;
}

@CustomProperty(
name = "[Link]",
value = "true"
)
public Loan(@BusinessName("amount") int amount, @BusinessName("duration") int
duration, @BusinessName("yearlyInterestRate") double yearlyInterestRate) {
this();
[Link] = amount;
[Link] = duration;
[Link] = yearlyInterestRate;
}

public int getAmount() {


return [Link];
}

public void setAmount(int a) {


[Link] = a;
}

@CustomProperty(
name = "[Link]",
value = "true"
)
public boolean isApproved() {
return [Link];
}

public String getApprovalStatus() {


return [Link]([Link]) + " " + [Link]();
}

public void setApproved(boolean approved) {


[Link] = approved;
}

public void reject() {


[Link] = false;
}

public int getDuration() {


return [Link];
}

public void setDuration(int d) {


[Link] = d;
}

public double getYearlyInterestRate() {


return [Link];
}

public void setYearlyInterestRate(double rate) {


[Link] = rate;
}

public Collection<String> getMessages() {


return [Link];
}

public void removeFromMessages(String argument) {


[Link](argument);
}

public void addToMessages(String argument) {


[Link](argument);
}

public int getYearlyRepayment() {


if ([Link] == 0 && [Link] != 0.0D &&
[Link] != 0) {
[Link] = [Link]();
}

return [Link];
}

private int computeYearlyRepayment() {


double i = [Link] / 12.0D;
double p = i * (double)[Link] / (1.0D - [Link](1.0D + i, (double)(-
[Link])));
return (int)(p * 12.0D);
}
}

You might also like