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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started