Sunday, 12 March 2023

2. A motor cycle dealer sells two-wheelers to his customer on loan, which is to be repaid in 5 years. The dealer charges simple interest for the whole term on the day of giving the loan itself. The total amount is then divided by 60(months) and is collected as equated monthly instalment (EMI). Write a program to calculate the EMI for a loan of Rs. X, where X is given from command line argument. Print the EMI value in rupees.



class Program2
{
    public static void main(String args[])
    {
        int amount = Integer.parseInt(args[0]);
        float rate = Float.parseFloat(args[1]);
        int time = 5;
       
        float si = (amount * rate * time) / 100;
       
        float tamount = si + amount;
       
        float emi = tamount / 60;
       
        System.out.println("EMI is: " + emi);
    }
}


No comments:

Post a Comment

python programs

1. sum of two number