troubleshooting Question

New to Java Using Eclipse for a class with only C# programming in the past

Avatar of jerry-2112
jerry-2112Flag for Afghanistan asked on
JavaC#Java EE
3 Comments1 Solution470 ViewsLast Modified:
I'm in a Java programming class.  Pretty basic for most of you guys.  I've only done C# programming in the past.  Pretty new to programming to start with anyway.  Already getting errors on the following program.  Trying to us the \n to start the next line.  Something I never did in C#.  Here is a look at my code and the errors I get.  Does anybody know a good began-er book with sample codes ? I work better by seeing examples.  Thanks please tell me what I'm missing here.

 String radius; //radius entered by user
        double radius1; // converted user input
             
        //get radius from user
        radius = JOptionPane.showInputDialog("Enter the Radius");
        //convert numbers from string to type Double
        radius1 = Double.parseDouble(radius);
     
        JOptionPane.showMessageDialog(null,  "The Diameter Is " +      (2*radius1)"\nThe Circumference Is "
       + (2 * Math.PI * radius1) " \nThe Area Is " + (Math.PI * radius1 * radius1));



When I separate I get it to work, but my lab is to have all in one display box.
This works but .....
 String radius; //radius entered by user
        double radius1; // converted user input
       
        //get radius from user
        radius = JOptionPane.showInputDialog("Enter the Radius");
        //convert numbers from string to type Double
        radius1 = Double.parseDouble(radius);
     
        JOptionPane.showMessageDialog(null,"The Diameter Is " + (2*radius1));
        JOptionPane.showMessageDialog(null,"\nThe Circumference Is "+ (2 * Math.PI * radius1));
        JOptionPane.showMessageDialog(null, " \nThe Area Is " + (Math.PI * radius1 * radius1));
ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 1 Answer and 3 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 3 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros