Question: Convert the following if statement using a swicth statement: // Find interest rate based on year if (numOfYears== 7) annualInterestRate = 7.25; else if (numOfYears

Convert the following if statement using a swicth statement:

// Find interest rate based on year

if (numOfYears== 7)

annualInterestRate = 7.25;

else if (numOfYears == 15);

annualInterestRate = 8.50;

else if (numOfYears == 30);

annualInterestRate = 9.0;

else {

System.out.print1n("Wrong number of years");

System.exit( 0 );

}

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!