Computer Science, asked by arkamukherjee324, 1 month ago

please sove this programming and don't spam​

Attachments:

Answers

Answered by anindyaadhikari13
9

\texttt{\textsf{\large{\underline{Solution}:}}}

The given problem is solved using language - Java.

import java.util.*;

public class Brainly{

   public static void main(String s[]){

       double principal,rate,time,si=0,amount;

       Scanner sc=new Scanner(System.in);

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

       principal=sc.nextDouble();

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

       time=sc.nextDouble();

       sc.close();

       if(time<=0)

           System.out.println("Invalid Choice. Program terminated.");

       else{

           if(time<=6){

               si=principal*5.0*time/100;

           }

           else if(time<=12){

               si=(principal*5*6/100)+(principal*5.5*(time-6)/100);

           }

           else if(time<=24){

               si=((principal*5*6)+(principal*5.5*6)+(principal*6.0*(time-12)))/100;

           }

           else if(time<=36){

               si=((principal*5*6)+(principal*5.5*6)+(principal*6.0*12)+(principal*6.5*(time-24)))/100;

           }

           else{

               si=((principal*5*6)+(principal*5.5*6)+(principal*6*12)+(principal*6.5*12)+(principal*7*(time-36)))/100;

           }

           amount=principal+si;

           System.out.println("Amount: "+amount);

       }

   }

}

\texttt{\textsf{\large{\underline{Logic}:}}}

  1. Accept the principal and time from the user.
  2. Check if the entered data is valid or not.
  3. If valid, calculate the rate of interest as per the conditions given.
  4. Using formula SI = PTR/100, calculate the simple interest.
  5. Calculate Amount using formula A = P + SI.
  6. Display the amount.

See attachment for output.

Attachments:

anindyaadhikari13: Thanks for the brainliest ^_^
Similar questions