0% found this document useful (0 votes)
28 views2 pages

Homework Correct Prog Am

The document contains code snippets for 3 Java programs to calculate rate of interest, total salary, and simple interest given various financial inputs. It defines the purpose, variables, data types, and descriptions for each code example.

Uploaded by

faran
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
28 views2 pages

Homework Correct Prog Am

The document contains code snippets for 3 Java programs to calculate rate of interest, total salary, and simple interest given various financial inputs. It defines the purpose, variables, data types, and descriptions for each code example.

Uploaded by

faran
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

1.

Write a program to find rate of interest when Principal=6000, time=2yrs,


interest=1500.
public class prog1
{
public static void main()
{
int p=6000;
int si=1500;
int t=2;
double r=0;
r=(100*si)/(p*t);
System.out.println("Rate= "+r);
}
}
Variables Data Types Descriptions
p int principal amount given
si int interest amount given
t int time amount given
r double rate amount as output

2. Write a program to find total income of a salesman monthly when basic=4000,


medical=300, travelling allowance=1000, deduct for provident fund(pf)=800. Total salary=
basic+ medical + travelling allowance- pf.

public class prog2


{
public static void main()
{
int b=4000;
int m=300;
int ta=1000;
int pf=800;
int ts=0;
ts=b+m+ta-pf;
System.out.println("Total salary= "+ts);
}
}
Variables Data Types Descriptions
b int basic amount given
m int medical amount given
ta int travelling allowance amount given
pf int provident fund amount given
ts int total salary amount as output
3. Write a program to find simple interest considering principal, rate and time as
input.
public class prog3
{
public static void main(int p,int r,int t)
{
double si=0;
si=(p*t*r)/100;
System.out.println("Simple Interest= "+si);
}
Variables Data Types Descriptions
p int principal amount as input
t int time amount as input
r int rate amount as input
si double simple interest amount as output

You might also like