Question: I'm having trouble writing this loan code for a javascript. Here's the question. Write a program that takes the following as the inputs fro the

I'm having trouble writing this loan code for a javascript. Here's the question. Write a program that takes the following as the inputs fro the user: The annual salary, the number of years at the current job. Then the program should determine that whether the user qualifies for loan. For the employee to qualify for the loan he or she must be earning a salary of greater than $5000 or has to be in the Job for 5 or more years.

Here's my code thus far:

import java.util.Scanner;

public class LoanCalculator { public static void main(String[] args) { LoanCalculator loanCalculator = new LoanCalculator(); Scanner sc = new Scanner(System.in); loanCalculator.acceptLoanAmt(sc);

} public void acceptLoanAmt(Scanner sc) { System.out.println("What is your annual salary?"); sal = sc.next.Double(); System.out.println("How many years have you been at current job?"); numYears =sc.next.Int();

int numYears; double sal; } public String qualifyLoan(int numYears, double sal) { String message = ""; if(sal >= 5000 || numYears >= 5) { System.out.println("Loan accpeted"); } else { System.out.println("Loan denied!"); } return ""; } }

What's wrong with my code and how can I complete it?

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!