Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

6-3. What is protectionism?

Answered: 1 week ago

Question

2. Describe how technology can impact intercultural interaction.

Answered: 1 week ago

Question

7. Define cultural space.

Answered: 1 week ago