Back | Reverse | Quick Reply | Post Reply |

I need to compile, but no TextPad or anything
Link | by on 2010-10-20 21:16:15 (edited 2010-10-20 21:20:59)
please check this, I really need help




import java.util.*;

public class Q1401111503
{
public static void main(String[]arg)
{
Scanner in=new Scanner(System.in);
int a;
float b;
int c;
int d;
double e;
int f;
double g;

System.out.println(" Let's play with area and Circumference ^__^");

System.out.println(" =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-");

System.out.println("Area and Circumference of square");
System.out.println("-------------------------");
System.out.println("input the side of Square : ");
a= in.nextInt();
System.out.println("Area of square is = side * side = "+a*a);


System.out.println("Circumference of square is = 4 * side = "+4*a);


System.out.println("Area of circle and half of circle");
System.out.println("-------------------------------------");
System.out.println("input radius of the circle : ");
b= in.nextFloat();
e=b*b*Math.phi;

System.out.println("Area of circle with radius "+b+" = Pi * r * r = "+e);

System.out.println("Area of half circle with radius "+b+" ="+b*b*Math.phi/2);


System.out.println("Area and Circumference of rectangle");
System.out.println("-------------------------------------");
System.out.println("input length of rectangle : ");
c=in.nextInt();
System.out.println("input width of rectangle : ");
d=in.nextInt();
f=c*d;

System.out.println("Area of rectangle with length "+c+" and width "+d+" = p * l = "+f);

System.out.println("Circumference of rectangle with length "+c+" and width "+d+" = 2 * (p + l) ="+2*(c+d));


System.out.println("If the Area of rectangle minus the Area of Circle , The result is "+f-e);

System.out.println("Just notice to you, The result from 3 % 2 is 1");




}

}




thanks


Re: I need to compile, but no TextPad or anything
Link | by Pioneer Plus on 2010-11-08 06:07:37 (edited 2010-11-08 06:17:40)
You probably forget to write import java.math.*;
And it's not Math.phi by the way, the correct expression is Math.PI.

The last is... you should add a bracket on this line


The rest is an OK! Em... why can't use compiler or such? If happen by any chance are you in the middle of Exam at the time?

Left_SG Right_SG

Re: I need to compile, but no TextPad or anything
Link | by on 2010-11-08 06:22:26
hi, pioneer plus, thanks for the help... but was solved several days ago...

I was using notepad, so I just... well, you know, putting that on forums and send them to my friends as a message...


Back | Reverse | Quick Reply | Post Reply |

Copyright 2000-2024 Gendou | Terms of Use | Page loaded in 0.0022 seconds at 2024-12-30 11:41:03