Computer Science (Basics)

public class Circumference {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
;
final double PI = 3.14159;

int radius = 10;
double area = PI * radius *radius;
double circum = 2 * PI * radius;


System.out.println("The area of a circle with radius " + radius + " is " + area);
System.out.println("The circum of a circle with radius " + radius + " is " + circum);


radius = 20;
area = PI * radius * radius;
circum = 2 * PI * radius;

System.out.println("The area of a circle with radius " + radius + " is " + area);
System.out.println("The circum of a circle with radius " + radius + " is " + circum);


I got this so far... I need to make a area2... then I have to divide area2/area1.... I then need a println statement for it.... Can anyone help? How do i make an area2, and what would the println statement for dividing the two be?

  1. 👍 0
  2. 👎 0
  3. 👁 153
asked by Mike

Respond to this Question

First Name

Your Response

Similar Questions

  1. Java Panel Problem

    I am supose to draw a grid and center it with a 10 pix border all the way around it. I have done this but no matter what I do I cannot get a 10 pix border. Here is my code. You will notice i have added 20 to the setsize param to

    asked by Robert on December 19, 2009
  2. Computer Programming

    I already posted this question but I gave it a try I'm not sure if I'm on the right track: Make a util class with three methods. First method's name is add, that returns the result by adding two numbers. Second method's name is

    asked by Jake on July 8, 2015
  3. Java

    1 public class testOperators 2 { 3 public static void main(String[] args) 4 { 5 int x; 6 int y = 12 7 double z = 13.0; 8 x = 14 9 System.out.println(“x + y + z = “ + (x + y +z)); 10 x += y; 11 y--; 12 z++; 13 z *= x; 14

    asked by SCCC on January 31, 2009
  4. Java programming

    without running on java, what is the final answer, please show your work. public class sample { public static void main(String[] args){ Sample x = new Sample(); int i = 10; int b = x.g(i); System.out.println(b + i); } public int

    asked by anonymous on April 8, 2019
  5. Java

    I need help putting the following trace into pseudocode 1 public class testOperators 2 { 3 public static void main(String[] args) 4 { 5 int x; 6 int y = 12 7 double z = 13.0; 8 x = 14 9 System.out.println(“x + y + z = “ + (x +

    asked by SCCC on January 31, 2009
  6. Computer Science

    public class PrimeNumbers { public static void main(String[] args) { int x = 100; for(int i=2; i

    asked by Jake on July 30, 2015
  7. Java Programming

    Add 2 constructors to the Course class. One that takes no arguments and initializes the data to all 0’s and “” (empty strings). And one constructor that takes all 4 arguments, one argument for each property and then sets the

    asked by John on March 17, 2018
  8. Computer Programming

    I posted this question before: How would I put this into one program? These are the directions: Write a method that takes two parameters. If the first parameter is equal to second parameter. Multiply both and print result. If the

    asked by Jake on July 5, 2015
  9. Java programming

    Hi, I'm trying to figure out how to implement toString() methods into the JavaTest and H2ClassB classes so that the output would be 4 3 7 5 99 3: import java.util.ArrayList; public class JavaTest { ArrayList list = new ArrayList

    asked by Nina on June 10, 2017
  10. Programming

    Why is the output of the code 14, not 8 : alpha=3+5=8? public class Application4{ public static void main(String[] args) { int alpha=3; int beta=5; switch (beta){ case 3:alpha=alpha+3; case 4:alpha=alpha+4; case 5:alpha=alpha+5;

    asked by Ashley on October 1, 2019

More Similar Questions