Convert Integer?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • pantherxin
    New Member
    • Apr 2010
    • 12

    #1

    Convert Integer?

    Writing program to calculate cir., area, etc. of circle. Radius is input as integer; how to convert integer to proceed with calculations?
  • jkmyoung
    Recognized Expert Top Contributor
    • Mar 2006
    • 2057

    #2
    1. List your outputs and figure out what type of variable they should be.
    2. Find the formulas for each of your outputs based on your input.
    3. Program these formulas in.

    Show code that you're using so far. Are you using a Scanner?
    Code:
     Scanner sc = new Scanner (System.in);
    int radius = sc.nextInt();

    Comment

    • pantherxin
      New Member
      • Apr 2010
      • 12

      #3
      Actually, you led me in the right direction, but this is what I did and program ran;

      System.out.prin t( "Enter radius: " ); // prompt
      radius = input.nextInt() ; // read first entry from user

      Thanks!

      Comment

      Working...