Question
import java.util.Scanner; public class creditScore { public static void main(String[]args) { // declare and initialize variables int creditScore; double loanAmount,interestRate,interestAmount; final double I_a = 5.56,I_b
import java.util.Scanner;
public class creditScore
{
public static void main(String[]args)
{
// declare and initialize variables
int creditScore;
double loanAmount,interestRate,interestAmount;
final double I_a = 5.56,I_b = 6.38,I_c = 7.12,I_d = 9.34,I_e = 12.45,I_f = 0;
String instructions = "This program calculates annual interest "+"based on a credit score. ";
String output;
Scanner input = new Scanner(System.in);// for receiving input from keyboard
// get input from user
System.out.println(instructions );
System.out.println("Enter the loan amount: $");
loanAmount = input.nextDouble();
System.out.println("Enter the credit score: ");
creditScore = input.nextint();
System.out.println();// print blank line
//process data
if(creditScore>=720&&creditScore<=850)
interestRate = I_a;
else if(creditScore>=690&&creditScore<=719)
interestRate = I_b;
else if(creditScore>=660&&creditScore<=689)
interestRate = I_c;
else if(creditScore>=625&&creditScore<=689)
interestRate = I_d;
else if(creditScore>=590&&creditScore<=624)
interestRate = I_e;
else if(creditScore<590)
interestRate = I_f;
interestAmount = loanAmount*interestRate;
// output
output = "The loan amount is $" +loanAmount + " "
+ "The credit score is" + creditScore + " "
+ "The interest rate is" + interestRate + " "
+ "The interest is $" + interestAmount + " "
+ "End of program ";
// display output
System.out.println(output);
}//end main
}//end class
output-
creditScore.java:28: error: cannot find symbol
creditScore = input.nextint();
^
symbol: method nextint()
location: variable input of type Scanner
1 error
please fix the error and update 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