This Operator - Java

This is an operator which represents current object.

WRITE A PROGRAM TO FIND THE SIMPLE INTEREST USNIG THE CONSTRUCTOR AND THIS OPERATOR.

class Interset
{
int p,n,r;
Interset(int p,int n,int r)
{
this.p=p;
this.n=n;
this.r=r;
}
public int result()
{
return((p*n*r)/100);
}
}
class Sample
{
public static void main(String args[])
{
Interset i=new Interset(1000,10,5);
int k=i.result();
System.out.println("interest"+k);
}
}

 

For
Online Classes

Contact Us: 9885348743