Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Client extends Credit{
- private String firstName;
- private String lastName;
- private int age;
- private double budget;
- private int repaymentTime;
- public Client(CreditType creditType, String firstName, String lastName, int age, double budget, int repaymentTime) {
- super(creditType);
- this.firstName = firstName;
- this.lastName = lastName;
- setAge(age);
- this.budget = budget;
- setRepaymentTime(repaymentTime);
- }
- public String getFirstName() {
- return this.firstName;
- }
- public String getLastName( ) {
- return this.lastName;
- }
- public void setAge(int age) {
- if (age < 18 || age > 90) {
- throw new IllegalArgumentException("Cannot give credit to that person");
- } else {
- this.age = age;
- }
- }
- public int getAge() {
- return this.age;
- }
- public double getBudget() {
- return this.budget;
- }
- public void setRepaymentTime(int repaymentTime) {
- if (repaymentTime < 3) {
- throw new IllegalArgumentException("Repayment time too low");
- }
- else {
- this.repaymentTime = repaymentTime;
- }
- }
- public int getRepaymentTime() {
- return this.repaymentTime;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement