Area of a Circle Demo

Run Settings
LanguageJava
Language Version
Run Command
/* * This program will calculate the area of a circle given the radius * * C Rilett ICS3U/3C * @author Connor */ public class AreaOfCircle { /** * @param args the command line arguments */ public static void main(String[] args) { // declare variables int radius, length, width; double pi, areaOfCircle, areaOfSquare; // assign values to variables pi = 3.14; radius = 5; length = 6; width = 8; // calculate area areaOfCircle = pi * radius * radius; areaOfSquare = length * width; //print results System.out.println ("The area of a circle with radius of "+ radius +"cm is "+ areaOfCircle + "cm"); System.out.println ("The area of a rectangle with a length of "+ length +"cm and width of " + width + "cm is "+ areaOfSquare + "cm"); } }
Editor Settings
Theme
Key bindings
Full width
Lines