Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I need heeeellllllp on the banking loan problem i need to ask the user what type

ID: 3773581 • Letter: I

Question

I need heeeellllllp on the banking loan problem i need to ask the user what type of a loan they want and how much they want to borrow and it should ask the user that the loan will take the how many months it will be repaid and if it cannot repaid it will give them a warning message saying the loan cannot be repaid at this time of an increase of the loan amount i really need this to be done today

import java.util.*;
public class BankLoan2 {

   public static void main(String[] args)
   {

       //Create a Scanner Object
       Scanner input = new Scanner(System.in);
       String loanType;
       double loanAmount=0;
       double MonthlyInterest=0;
       double AnnualInterestRate=0;
       double MonthlyPayment=0;
       int NumberofMonths=0;
      
  
      
  
       //Ask the user what type of loan they want to apply for
       System.out.println("What kind of loan do you wish to apply for ");

       //Get that type of loan.
       loanType = input.nextLine();

       //Ask the user to Enter the loanAmount that you are apply for.
       System.out.println("How much do you want to borrow ");
loanAmount = input.nextDouble();
       //Ask the user to Enter what interest rate per year that will be applied for that particular loan.
       System.out.println(" Enter the interest rate per year that will be applied for ");
       //Get that interest rate number
   AnnualInterestRate= input.nextDouble();
       // Calculate what Monthly Interest Rate will they receive.
      

      
       System.out.println("The MonthlyPayment will be " );
       // Get the MonthlyPayment
       MonthlyPayment = input.nextDouble();
       //NumberOfMonths

      
       //Create a do while loop to calculate the monthly interest, loan amount,number of monthes,
       //and the error message that the loan cannot be repaid do to low monthly payment that the loan amount
       //had increased.

   while(AnnualInterestRate>=0);
   {
      MonthlyInterest = AnnualInterestRate*(AnnualInterestRate/12/100);

AnnualInterestRate=AnnualInterestRate-(MonthlyPayment-MonthlyInterest);
           NumberofMonths++;
           }
           //Print Results
          
           System.out.println("The NumberOfMonths to repay the loan is" + NumberofMonths);
          
       }
}

Explanation / Answer

This below code part is I updated for when loan amount is less than the monthly payment..it will give the warning message like.."he loan cannot be repaid at this time of an increase of the loan amount".

The major error is here calculating the Number Months, Monthly Interrest Rate formaules are incorrect..Please provide me the Correct formalue so that it will get the Number of EMIs.

See the below code part will have if and else condition..if condition will give the warning message and else part will

calculate the Number of EMIS

// If the Loan Amount is less than the MonthlyPayment then It will give the Warning Message
       // Else it will calculate the number of months loan has to be pay.
       if(loanAmount <= MonthlyPayment)
       {
           System.out.println("loan cannot be repaid at this time of an increase of the loan amount");
       }
       else
       {
           //NumberOfMonths
           //Create a do while loop to calculate the monthly interest, loan amount,number of monthes,
           //and the error message that the loan cannot be repaid do to low monthly payment that the loan amount
           //had increased.
           while(AnnualInterestRate>=0);
           {
               MonthlyInterest = AnnualInterestRate*((AnnualInterestRate/12)/100);
               AnnualInterestRate=AnnualInterestRate+(MonthlyPayment-MonthlyInterest);
               NumberofMonths++;
           }
           //Print Results      
           System.out.println("The NumberOfMonths to repay the loan is" + NumberofMonths);
       }

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote