# Field Manual for Hackers

## Java program to calculate simple Interest

1. import java.util.Scanner;

class Test{

public static void main(String ar[])
{

float p,i,n;
Scanner sc=new Scanner(System.in);
System.out.println("Enter Principal");
p=sc.nextFloat();
System.out.println("Enter Interest Rate");
i=sc.nextFloat();
System.out.println("Enter Term of the Loan");
n=sc.nextFloat();
System.out.println("Simple Interest is "+(p*i*n));

}
}

2. \\program calculate to simple interest
import java.util.Scanner;
class Simpleinterest
{
public static void main(String Args[])
{
float p,r,t,si;
Scanner scan=new Scanner(System.in);
System.out.println("enter the value of principal\n");
p=scan.nextFloat();
System.out.println("enter the value of rate\n");
r=scan.nextFloat();
System.out.println("enter the value of time\n");
t=scan.nextFloat();
si=(p*r*t)/100;
System.out.println("simple interest is"+si);
}
}

3. import java.util.Scanner;
class SimpleInterest
{
public static void main(String ar[])
{
double Pri,Total,ROI,Time;
Scanner sc=new Scanner(System.in);
System.out.println("Enter the value of principal");
Pri=sc.nextDouble();
System.out.println("Enter the value of rate of interest");
ROI=sc.nextDouble();
System.out.println("Enter the value of Time");
Time=sc.nextDouble();
Total=Pri*ROI*Time;
System.out.println("Smple interest="+Total);
}
}

4. import java.util.Scanner;

class Interest
{
public static void main(String ar[])
{
Double p,i,r,t;
System.out.print("Enter amount: ");
Scanner w=new Scanner(System.in);
p=w.nextDouble();
System.out.print("Enter interest rate: ");
r=w.nextDouble();
System.out.print("Enter time period: ");
t=w.nextDouble();
i=p*r*t/100;
System.out.println("Simple interest is: "+i);
}
}

5. import java.util.Scanner;

class simpleinterest
{
public static void main(String ar[])
{
Scanner bucky = new Scanner(System.in);
double principal,rate,time;
System.out.println("enter the principal amount : ");
principal = bucky.nextDouble();
System.out.println("enter the rate : ");
rate = bucky.nextDouble();
System.out.println("enter the time : ");
time = bucky.nextDouble();
double interest = (principal*time*rate)/100;
System.out.println("the simple interest on the given amount is : " +interest);

}

}

6. import java.util.Scanner;
class A
{
public static void main(String args[]);
{
Scanner obj=new Scanner(System.in);
int p,r,t;
System.out.println("Enter the value of p,r,t");
p=obj.nextInt();
r=obj.nextInt();
t=obj.nextInt();
int sim;
sim=(p*r*t)/100;
System.out.println("The simple interest is="+sim);
}
}

7. import java.util.Scanner;
public class Simple
{
public static void main(String args[])
{
float i,p,r,t;
System.out.println("enter number");
Scanner sc=new Scanner(System.in);
p=sc.nextFloat();
r=sc.nextFloat();
t=sc.nextFloat();
i=p*r*t/100;
System.out.println(i);
}
}

8. import java.util.Scanner;
class Interest1{
public static void main(String ar[]){
Scanner obj=new Scanner(System.in);
int p,r,t;
float si;
System.out.println("enter the value of principle amount");
p=obj.nextInt();
System.out.println("enter the value of rate");
r=obj.nextInt();
System.out.println("enter the value of time");
t=obj.nextInt();
si=p*r*t/100;
System.out.println("the calculated simple interest is"+si);
}

}

9. class SimpleInterest{
public static void main(String ar[]){
int p=Integer.parseInt(ar[0]);
int r=Integer.parseInt(ar[1]);
int t=Integer.parseInt(ar[2]);
int i=0;
i=p*r*t;
System.out.printf("SimpleInterest="+i);
}
}

10. package com.example.myapplication;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;

public class SimpleInterest extends Activity {

int P,t;
float SI,r;
Button btSI;
EditText etSIp,etSIr,etSIt;
TextView tvSI;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.simple_interest);
btSI=findViewById(R.id.btSI);
etSIp=findViewById(R.id.etSIp);
etSIt=findViewById(R.id.etSIt);
etSIr=findViewById(R.id.etSIr);
tvSI=findViewById(R.id.tvSI);

btSI.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
P=Integer.parseInt(etSIp.getText().toString());
r=Integer.parseInt(etSIr.getText().toString());
t=Integer.parseInt(etSIt.getText().toString());

SI=P((int) (1+(r*t)));

tvSI.setText("Simple Interest="+SI);

}

private float P(int i) {
return 0;
}

});
}
}