can you please do some changes in the code and make this code unique and work better but give same output import java.util.Scanner; class Emi { public static void main(String []args) {...



can you please do some changes in the code and make this code unique and work better but give same output

import java.util.Scanner;

class Emi

{

    public static void main(String []args)

    {

        Scanner a = new Scanner(System.in);


        double principal, rate, time, emi;


        System.out.print("Enter principal: ");

        principal = a.nextFloat();


        System.out.print("Enter rate: ");

        rate = a.nextFloat();


        System.out.print("Enter time in year: ");

        time = a.nextFloat();


        rate=rate/(12*100);

        time=time*12;



        emi= (principal*rate*Math.pow(1+rate,time))/(Math.pow(1+rate,time)-1);


        System.out.print("Monthly EMI is= "+emi+"\n");


    }

}



Output:














1

2

3

4




Enter principal: 1200

Enter rate: 20

Enter time in the year: 1

Monthly EMI is= 111.16140707649637






Output2:














1

2

3

4




Enter principal: 2000

Enter rate: 20

Enter time in the year: 2

Monthly EMI is= 101.79160528647809






Output3:














1

2

3

4




Enter principal: 2000

Enter rate: 20

Enter time in the year: 3

Monthly EMI is= 74.32716671948111







Jun 04, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here