Knowee
Questions
Features
Study Tools

Design a Java program to process loan applications for customers. Each loan application includes details such as the applicant's name, salary, and loan amount. The program evaluates each loan application based on certain criteria. If the applicant's salary is greater than $50,000 and the requested loan amount is within twice the applicant's salary, the loan application is approved; otherwise, it is rejected. Implement the program using classes and objects. Write a Java code that performs the following tasks: Define a class LoanApplication with private fields for the applicant's name, salary, loan amount, and loan approval status.Implement a constructor to initialize the loan application details.Create a method processLoan() to evaluate the loan application based on the specified criteria.Define a class Loan with a main method to interact with the user.Prompt the user to input details for multiple loan applications.Process each loan application and display whether it is approved or rejected.Additionally, display the names, salaries, and loan amounts of customers whose loan applications are approved.Demonstrate the functionality of your program with a sample input/output scenario.

Question

Design a Java program to process loan applications for customers. Each loan application includes details such as the applicant's name, salary, and loan amount. The program evaluates each loan application based on certain criteria. If the applicant's salary is greater than $50,000 and the requested loan amount is within twice the applicant's salary, the loan application is approved; otherwise, it is rejected. Implement the program using classes and objects. Write a Java code that performs the following tasks: Define a class LoanApplication with private fields for the applicant's name, salary, loan amount, and loan approval status.Implement a constructor to initialize the loan application details.Create a method processLoan() to evaluate the loan application based on the specified criteria.Define a class Loan with a main method to interact with the user.Prompt the user to input details for multiple loan applications.Process each loan application and display whether it is approved or rejected.Additionally, display the names, salaries, and loan amounts of customers whose loan applications are approved.Demonstrate the functionality of your program with a sample input/output scenario.

...expand
🧐 Not the exact question you are looking for?Go ask a question

Solution

Here is a simple Java program that meets your requirements:

import java.util.Scanner;

class LoanApplication {
    private String name;
    private double salary;
    private double loanAmount;
    private boolean isApproved;

    public LoanApplication(String name, double salary, double loanAmount) {
        this.name = name;
        this.salary = salary;
        this.loanAmount = loanAmount;
        this.isApproved = false;
    }

    public void processLoan() {
        if (salary > 50000 && loanAmount <= 2 * salary) {
            isApproved = true;
        }
    }

    public boolean isApproved() {
        return isApproved;
    }

    public String getName() {
        return name;
    }

    public double getSalary() {
        return salary;
    }

    public double getLoanAmount() {
        return loanAmount;
    }
}

public class Loan {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.println("Enter the number of loan applications: ");
        int n = scanner.nextInt();
        LoanApplication[] applications = new LoanApplication[n];

        for (int i = 0; i < n; i++) {
            System.out.println("Enter applicant's name, salary and loan amount: ");
            String name = scanner.next();
            double salary = scanner.nextDouble();
            double loanAmount = scanner.nextDouble();
            applications[i] = new LoanApplication(name, salary, loanAmount);
            applications[i].processLoan();
        }

        for (LoanApplication application : applications) {
            if (application.isApproved()) {
                System.out.println("Loan approved for " + application.getName() + " with salary " + application.getSalary() + " and loan amount " + application.getLoanAmount());
            } else {
                System.out.println("Loan rejected for " + application.getName());
            }
        }
    }
}

This program first asks the user for the number of loan applications. Then, for each application, it asks for the applicant's name, salary, and loan amount. It creates a LoanApplication object for each application and processes it. Finally, it prints out the result for each application.

This problem has been solved

Similar Questions

Write a Java program to manage billing information for customers. The program should allow the user to input details for multiple customers and bills. For each customer, the program should prompt the user to enter a customer ID and name. For each bill, the program should prompt the user to enter a bill number, amount, date, and the corresponding customer ID. Once the user has input all the necessary information, the program should allow the user to search for bills by customer ID. Upon entering a customer ID, the program should display all bill amounts, dates, and numbers associated with that customer ID. Frame the program using classes for Customer and Bill, and implement methods to retrieve customer and bill details. Sample Input 3 // Number of Customers 1  // Customer IDJai // Customer Name 2Sakthi 3John 5 // Number of Bills 11  // Bill Number45663 // Bill Amount02/12/2023 // Bill Date2 // Customer ID 4489609/12/20232 77896509/04/20231 99675404/11/20221 33876511/11/202332 Sample Output 1145663.002/12/202344896.009/12/2023

Write a java program to create a bank account with Name of the account holder, type of account(savings or  current), Account number and Balance amount in the account. Also, create 5 customers for the class Bank_account using array of objects. Access the customers to perform credit, debit and display of balance.Input 1:Enter the customers:ReenaSavings1231000RobinCurrent4562000PraveenSavings7893000SherinCurrent2342500DeenaSavings5672000Enter choice:1. Credit2. Debit Output :ReenaSavings1232000

Write a Java program that has three interfaces1. Academic Fees with a method calcAA() which takes the number of course as input parameter to calculate the academic fees by assigning Rs.500/- per course.2. Hostel Fees with a method calcHF() which takes the number of days as input parameter to calculate the hostel fees by assigning Rs.50/- per day.3. Extracurricular Fees with a method calcECF() which takes the number of extra-curricular course as input parameter to calculate the extra-curricular fees by assigning Rs.600/- per extra-curricular course.Create classes and objects using interface to calculate the total fees for1. A general day scholar student involved in no extracurricular courses2. A general hosteller student involved in no extracurricular courses3.  A   scholar student involved in extracurricular courses4. A hosteler student involved in extracurricular courses

how to write java appliaction

You have been assigned to develop a Course Enrollment and Grade Management System in Java for a university. The system should provide functionality to enroll students in courses, assign grades to students, and calculate overall course grades for each student. The project should demonstrate the effective utilization of static methods and variables to keep track of enrollment and grade-related information across multiple instances of the Student and Course classes. It should also showcase your ability to manipulate object state and define behavior through instance methods.Requirements:Student Class:The Student class should have private instance variables to store student information such as name, ID, and enrolled courses.Implement appropriate access modifiers and provide public getter and setter methods for accessing and updating student information.Design a method to enroll students in courses. It should accept a Course object as a parameter and add the course to the student's enrolled courses.Implement a method to assign grades to students. It should accept a Course object and a grade for the student and update the student's grade for that course. Course Class:The Course class should have private instance variables to store course information such as course code, name, and maximum capacity.Use appropriate access modifiers and provide public getter methods for accessing course information.Implement a static variable to keep track of the total number of enrolled students across all instances of the Course class.Design a static method to retrieve the total number of enrolled students.CourseManagement Class:The CourseManagement class should have private static variables to store a list of courses and the overall course grades for each student.Use appropriate access modifiers to control access to the variables.Implement static methods to add new courses, enroll students, assign grades, and calculate overall course grades for each student.The addCourse method should accept parameters for course information and create a new Course object. It should add the course to the list of courses.The enrollStudent method should accept a Student object and a Course object. It should enroll the student in the course by calling the appropriate method in the Student class.The assignGrade method should accept a Student object, a Course object, and a grade. It should assign the grade to the student for that course by calling the appropriate method in the Student class.The calculateOverallGrade method should accept a Student object and calculate the overall course grade for that student based on the grades assigned to them.Administrator Interface:Develop an interactive command-line interface for administrators to interact with the Course Enrollment and Grade Management System.Display a menu with options to add a new course, enroll students, assign grades, and calculate overall course grades.Prompt the administrator for necessary inputs and call the appropriate methods in the CourseManagement and Student classes to perform the requested operations.Implement error handling to handle cases where invalid inputs are provided or when enrolling students in courses that have reached their maximum capacity.Documentation:Provide comprehensive documentation for the project, explaining the purpose and usage of each class, method, and variable.Describe how static methods and variables are utilized to track enrollment and grade-related information across multiple instances of the Student and Course classes.Include instructions for running the program and interacting with the administrator interface.

1/3

Upgrade your grade with Knowee

Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.