Ask coding questions

← Back to all posts
why wont it run
dantehaji (0)

import java.util.Scanner;

public class Circle
{
public static void main(String[] args)
{
//declarations
Scanner scan = new Scanner(System.in);
final double PI = Math.PI;
int radius, radius2;
double area, area2, circ, circ2;
double divideArea,divideCirc;
//inputs
System.out.println("Enter radius 1:");
radius=scan.nextInt();
System.out.println("Enter radius 2:");
radius2=scan.nextInt();

  //calc
  area= PI * Math.pow(radius,2);
  circ=2*PI*radius;
  area2= PI * radius2 * radius2;
  circ2=2*PI*radius2;
  
   divideArea=area2/area;
   divideCirc=circ2/circ;
   
    //outputs
 System.out.println("The area of a circle with radius " + radius + " is " +area);
 System.out.println("the circumference with radius is " + radius + " is " +circ);
 System.out.println("The area of a circle with radius " + radius2 + " is " +area2);
 System.out.println("the circumference with radius is " + radius2 + " is " +circ2);
 
 System.out.println("Radius doubled with area:" +divideArea);
 System.out.println("Radius doubled with circumference:" +divideArea);
 
}

}

Commentshotnewtop
Geocube101 (252)

On Repl.it the class in the Main.java file must be named "Main"
On line 3, change public class Circle to public class Main