/* calculate area of circle Copyright (C) 2009 Vegard Hammerseth (http://vegard.hammerseth.com) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. v1.0.0 */ /* import math lib. for getting pi */ import java.lang.Math; class circleArea { public static void main (String[] args) throws Exception { /* define vars */ double pi, radius, area; /* set values */ radius = 7.0; pi = Math.PI; /* caluclate area */ area = pi*radius*radius; System.out.format("Area of circle with radius %.3f is %.3f",radius,area); } }