You are on page 1of 4

/**

* @(#)SeriesForLogarithm.java
*
*
* @author
* @version 1.00 2011/3/10
*/

public class SeriesForLogarithm {

/**
* Creates a new instance of <code>SeriesForLogarithm</code>.
*/
public SeriesForLogarithm() {
}

/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
double x,y,n,P;
int sw,ctr;
System.out.printf("CTR X Y log(1+x)
DIFFERENCE");
x=0.70; ctr=1; sw=0; P=1.0;y=x; n=2.0;
while(x<=0.90)
{
while(n<=151.0)
{
P=P*x;
}
}
if(sw==0)
{ y=y-P/n; sw=1;}
else
{ y=y+P/n; sw=0;}
System.out.printf("\n%3d%7.2f%22.17f%23.17f%24.17f",ctr,x,y,Math.log(1+x),
(Math.log(1+x)-y));
x=x+0.01;
ctr++;
n=n+1.0;

}
}
import java.util.Scanner;
/**
* @(#)ComputerRental.java
*
*
* @author
* @version 1.00 2011/3/9
*/

public class ComputerRental {

/**
* Creates a new instance of <code>ComputerRental</code>.
*/
public ComputerRental() {
}

/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
int h,m;
double amt;
System.out.printf("INTERNET AND GAMING RENTAL (MINIMUM
P10.00..P20.00 per hour)");
Scanner console= new Scanner(System.in);
System.out.printf("\n\n\n ENTER TIME CONSUMED IN HOUR(s): ");
h=console.nextInt();
System.out.printf("\n\n ENTER TIME CONSUMED IN MINUTE(s): ");
m=console.nextInt();
if((h==0)&&(m<30))
{
amt=10.00;
}
else
{
amt=(h*20)+(m/3);
}
System.out.printf("\n\n RENTAL AMOUNT: P%.2f", amt);
}
}
import java.util.Scanner;
/**
* @(#)Torus.java
*
*
* @author
* @version 1.00 2011/3/9
*/

public class Torus {

/**
* Creates a new instance of <code>Torus</code>.
*/
public Torus() {
}
static double VolTorus(double a1, double b1)
{
double V;
V=(3.1416*3.1416*(a1+b1)*(b1-a1)*(b1-a1))/4.0;
return(V);
}
static double SurfaceArea(double a2, double b2)
{
double SA;
SA=3.1416*3.1416*((b2*b2)-(a2*a2));
return(SA);
}
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
Scanner console = new Scanner(System.in);
double a,b;
System.out.printf("\n ENTER THE INNER RADIUS OF TORUS: ");
a=console.nextDouble();
System.out.printf("\n ENTER THE OUTER RADIUS OF TORUS: ");
b=console.nextDouble();
System.out.printf("\n\n THE VOLUME OF THE TORUS IS %.4f cubic
units",VolTorus(a,b));
System.out.printf("\n\n THE SURFACEAREA OF THE TORUS IS %.4f squared
units",SurfaceArea(a,b));
}
}
import java.util.Scanner;
/**
* @(#)Torus.java
*
*
* @author
* @version 1.00 2011/3/9
*/

public class Torus {

/**
* Creates a new instance of <code>Torus</code>.
*/
public Torus() {
}
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
Scanner console = new Scanner(System.in);
double A,r,angle;
System.out.printf("\n ENTER THE RADIUS OF CIRCULAR SEGMENT: ");
r=console.nextDouble();
System.out.printf("\n ENTER THE ANGLE OF THE CIRCULAR SEGMENT: ");
angle=console.nextDouble();
A=(r*r*(angle - Math.sin(angle))/2.0;
System.out.printf("\n THE AREA OF THE CIRCULAR SEGMENT IS: %f", A);

}
}

You might also like