Computer Science, asked by andriyajenson1233, 3 months ago

please write correctly in a paper and show please​

Attachments:

Answers

Answered by KingdomOfNepal
5

Java Program using Constructor :-

import java. lang.*;

public class SimpleInterest

{

double p=0.0, r=0.0, t=0.0, si=0.0 ;

public SimpleInterest( )

{

p = 30000.0;

r = 4.0;

t = 3.0;

}

public void check( )

{

si = (p*r*t)/100

System.out.println("Simple Interest = " +si);

}

public static void main(String args[ ] );

{

SimpleInterest t = new SimpleInterest( )

t.check( );

}

}

Java Program using scanner :-

import java.util.*;

public class SimpleInterest

{

public static void main(String args [ ] )

{

Scanner sc = new Scanner(System.in);

double p=0.0, r=0.0, t=0.0, si=0.0 ;

System.out.println("Enter the principal");

p = sc.nextDouble( );

System.out.println("Enter the rate");

r = sc.nextDouble( );

System.out.println("Enter the time");

t = sc.nextDouble( );

si = (p*r*t)/100;

System.out.println("Simple Interest = +si");

}

}

Simple Java Program :-

class SimpleInterest

{

void main( )

{

double 30000.0, r = 4.0, t = 3.0;

double si = 0.0;

si = (p*r*t)/100;

System.out.println("Simple Interest = +si");

}

}

Similar questions