Project Programs
Project Programs
class Side
int v=sc.nextInt();
double a =Math.cbrt(v);
Output:
enter volume of a cube
25
Variable description:
import java.util.*;
class Energy
double m,h,v;
double g=9.81;
System.out.println("Enter mass:");
m=sc.nextDouble();
System.out.println("Enter velocity:");
v=sc.nextDouble();
System.out.println("Enter height:");
h=sc.nextDouble();
double pe=m*g*h;
double ke=1.0/2.0*m*Math.pow(v,2);
double me=pe+ke;
Output:
Enter mass:
28
Enter velocity:
Enter height:
37
import java.util.Scanner;
class FindSquareroot
int min=10,max=20;
}
Output
First number is 11
Second number is 19
Variable description
import java.util.*;
class slope
double m =(y2-y1)/(x2-x1);
System.out.println("Slope=" +m);
}
Output:
15
11
27
28
Slope= 1.0` 1
Variable description
import java.util.*;
class Velocity
double u = in.nextInt();
double a = in.nextInt();
double s = in.nextInt();
double v=0;
v=Math.pow(u,2)+2*a*s;
}
}
Output:
Enter acceleration: 14
Enter distance: 30
Variable description
import java.util.*;
class Smallest
int a,b,c,d,p;
a= sc.nextInt();
b= sc.nextInt();
c= sc.nextInt();
d= Math.min(a,b);
p= Math.min(c,d);
}
Output:
11
13
15
Smallest number=11
Variable description:
import java.util.*;
class Diagonal
int a;
double d;
a= sc.nextInt();
d= Math.sqrt (2)*a;
}
Output:
11
Side of a square=11
Diagonal of a square=15.556349186104047
Variable description:
import java.util.*;
class Expression
int a,b,c;
double d;
a= sc.nextInt();
b= sc.nextInt();
c= sc.nextInt();
d= 1/Math.pow(a,2)+ 1/Math.pow(b,3)+
1/Math.pow(c,4);
Output:
11
13
15
Variable description:
class Sum
a= 345; b=276;
c= a+b;
Output: