Answer to Question #254121 in Java | JSP | JSF for pvv

Question #254121

Calculate the interest for the given base amount. 


  if year > 15 then calculate 12% else 10%. 

  Find the maturity amount



1
Expert's answer
2021-10-20T14:29:10-0400
import java.util.Scanner;


public class App {
	/**
	 * The start point of the program
	 * 
	 * @param args
	 */
	public static void main(String[] args) {
		float amount, rate=12, years, interest;
		Scanner keyBoard = new Scanner(System.in);
		System.out.print("Enter the amount: ");
		amount = keyBoard.nextFloat();
		System.out.print("Enter the time period (years): ");
		years = keyBoard.nextFloat();
		//if year > 15 then calculate 12% else 10%. 
		if(years<=15) {
			rate =10;
		}
		keyBoard.close();
		interest = (amount * rate * years) / 100;
		System.out.print("Interest is: " + interest);
		keyBoard.close();


	}


}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS