Question: Below is my code and print out. How do I stop the second interest rate from printing? ----jGRASP exec: java CreditScore Enter the credit score:
Below is my code and print out. How do I stop the second interest rate from printing?
"----jGRASP exec: java CreditScore Enter the credit score: 822
Your Interest Rate: 5.56% Your Interest Rate: 0%
----jGRASP: operation complete."
Start of code:
import java.util.Scanner;
public class CreditScore
{
public static void main( String[] args )
{
// declare and initialize variables
int creditScore; double interestRate; Scanner input = new Scanner( System.in ); // for receiving input from keyboard
// get input from user System.out.print( "Enter the credit score: " ); creditScore = input.nextInt();
System.out.println(); // print blank line
// process data
if( creditScore >= 720 && creditScore <=850 ) System.out.println("Your Interest Rate: 5.56%"); else if(creditScore >= 690 && creditScore <=719) System.out.println("Your Interest Rate: 6.38%"); else if(creditScore >= 660 && creditScore <=689) System.out.println("Your Interest Rate: 7.12%"); else if(creditScore >= 625 && creditScore <=689) System.out.println("Your Interest Rate: 9.34%"); else if(creditScore >= 590 && creditScore <=624) System.out.println("Your Interest Rate: 12.45%"); else if(creditScore >= 0 && creditScore <=589); System.out.println("Your Interest Rate: 0%"); } // end main
} // end class
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
