Java Programming

  1. Java Program: to calculate simple interest
    public class SimpleInterest{
        public static void main(String args[]){
        int p=5000;
        int t=3;
        int r=15;
        float i=(p*t*r)/100;
        System.out.println("Interest="+i);
        System.out.println("principal and Interest="+(p+i));
        }
      }
    
  2. Output:
    Interest=2250.0
    principal and Interest=7250.0
                
                  
  3. Java Program: to calculate simple interest with user input
    import java.util.Scanner;
    public class SimpleInterest{
    public static void main(String args[]){
    	Scanner sc=new Scanner(System.in);
    	System.out.println("Enter principal Amount");
    	int p=sc.nextInt();
    	System.out.println("Enter Year");
    	int t=sc.nextInt();
    	System.out.println("Enter rate of Interest");
    	int r=sc.nextInt();
    	float i=(p*t*r)/100;
    	System.out.println("Interest="+i);
    	System.out.println("principal and Interest="+(p+i));
    }
    }
    
    
  4. Output
    Enter principal Amount
    6000
    Enter Year
    2
    Enter rate of Interest
    10
    Interest=1200.0
    principal and Interest=7200.0
    
                  
  5. Java program to calculate Simple Interest using method call
    import java.util.Scanner;
        public class SimpleInterest{
        public static void main(String args[]){
          SimpleInterest obj=new SimpleInterest();
          obj.simpleInterest();
        }
        void simpleInterest(){
        Scanner sc=new Scanner(System.in);
          System.out.println("Enter principal Amount");
          int p=sc.nextInt();
          System.out.println("Enter Year");
          int t=sc.nextInt();
          System.out.println("Enter rate of Interest");
          int r=sc.nextInt();
          float i=(p*t*r)/100;
          System.out.println("Interest="+i);
          System.out.println("principal and Interest="+(p+i));
        
          }
        }
        
      
  6. Output
    Enter principal Amount
    6000
    Enter Year
    3
    Enter rate of Interest
    10
    Interest=1800.0
    principal and Interest=7800.0
        
      

Others Programming Language

article

programming C

Muktarul Hossain
article

C++

Muktarul Hossain
article

Python

Muktarul Hossain
article

Website Design

Muktarul Hossain