JAVA help
1
Name:
Anonymous
2008-01-22 20:03
Hey, the &d is not working in this program.... anyone know why? I am new to java.
import java.util.Scanner;
public class Circle {
public static void main( String args[] )
{
Scanner input = new Scanner( System.in );
double radius;
double diameter;
double circum;
double area;
//Get Radius
System.out.println( "Enter Radius:" );
radius = input.nextInt();
//Figure Values
diameter = radius * 2;
circum = 3.14159 * diameter;
area = 3.14159 * radius * radius;
System.out.printf( "Diameter is %d\n: " , diameter );
}
}
2
Name:
Anonymous
2008-01-22 20:04
OP here, I ment the %d is not working...
3
Name:
Anonymous
2008-01-22 20:14
Your troll level is maximum.
4
Name:
Anonymous
2008-01-22 20:19
OP.. Um... when I go to run it, it stops at the %d and says a buncha error shit. Does the code look right?
5
Name:
Anonymous
2008-01-22 20:26
Probably a rounding error. Use Math.PI for greater accuracy.
6
Name:
Anonymous
2008-01-22 20:30
mm, I just tried that. Can a double variable be presented with the %d format?
7
Name:
Anonymous
2008-01-22 20:33
8
Name:
Anonymous
2008-01-23 5:07
This is the reason I come to /prog/, for the trolling and cheap laughs.
9
Name:
Anonymous
2008-01-23 5:47
%d is for integers. You need to use %f.
10
Name:
Anonymous
2008-01-23 8:45
SICPFLOOD
11
Name:
Anonymous
2008-01-23 12:39
I thought pi was much longer than that.
12
Name:
Anonymous
2008-01-23 18:21
3.14159265358979 is how much of Math.PI I remember. Lol
13
Name:
Anonymous
2008-01-23 18:38
in Java you don't use printf. ever. it's System.out.print or System.out.println
Also, you just put in the damn variable. System.out.print("The Diameter is " + diameter);
There, I killed the joke
14
Name:
Anonymous
2008-01-23 20:03
15
Name:
Anonymous
2008-01-23 20:43
>>14
But printf() isn't nearly as
ENTERPRISE as using the + operator
16
Name:
Anonymous
2009-03-06 9:56
Of the application Thanks.
18
Name:
Anonymous
2013-08-31 19:53
I liked the atmosphere of couple first episodes very much, then there were many rather uninteresting plot developments but overall very feel giving and satisfying experience.
19
Name:
Anonymous
2013-08-31 21:24
Teach a man to fish, and you just eliminated your customer base idiot. Their ignorance was your job security as a restaurant owner ! Now you have to face a foreclosure! Are you proud of yourself? Are you?