REDUNDANT | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
17th Jul 2017, 2:27 AM
Kittiphat Paopeng
9 Answers
+ 12
Look over what I said about the Scanner again. A Scanner does NOT store inputs. All it does is return what the user inputs. You have to store that scanned value in another variable. So why you're getting an error is because you're trying to multiply Scanners together. Try something like this: Scanner scan = new Scanner(System.in); int radius = scan.nextInt(); //scan gives back the number the user inputs, radius stores it //The rest of your code now works fine :)
19th Aug 2017, 7:56 AM
Tamra
Tamra - avatar
+ 12
You're welcome :D
19th Aug 2017, 7:57 AM
Tamra
Tamra - avatar
+ 9
First, the last 3 lines are not inside main(). Move the } brace so they're all in main(). Next, you're not storing the radius in a variable. radius is actually just your scanner. Rename your Scanner (in, scan, scanner, etc.), then make an int called rad or radius to store your input in. The pi symbol is not a legal symbol in Java. Switch it out with Math.PI or 3.14.
17th Jul 2017, 3:05 AM
Tamra
Tamra - avatar
+ 7
Your main ends too early. There is stuff outside main.
17th Jul 2017, 2:32 AM
J.G.
J.G. - avatar
+ 2
OHHHH thanks
19th Aug 2017, 7:57 AM
Kittiphat Paopeng
+ 2
thanks Tamara it is now complete (the code)
19th Aug 2017, 8:14 AM
Kittiphat Paopeng
+ 1
Tamara appreciate Ur help but what u said about the scanner is false but that doesn't matter the rest u said helps heaps.... sorry I couldn't reply sooner
19th Aug 2017, 7:38 AM
Kittiphat Paopeng
+ 1
J.G thanks for Ur help too also sorry I couldn't reply sooner
19th Aug 2017, 7:39 AM
Kittiphat Paopeng
+ 1
THANKS GUYS A BUNCH... but now I face a new error with the operands I don't know if it is I used the same variable twice or that I need to use a different operator
19th Aug 2017, 7:44 AM
Kittiphat Paopeng