//CS5-HMC-Sp.,00-HW3-3 //A. Khakpour, May, 00 import java.text.*; class SphereCalculations { //----------------------------------------------------------------- // Computes the volume and surface area of a sphere given its radius. //----------------------------------------------------------------- public static void main (String[] args) { double radius, area, volume; System.out.print ("Enter the sphere's radius: "); radius = Keyboard.readDouble(); volume = 4.0 / 3.0 * Math.PI * Math.pow(radius, 3); area = 4 * Math.PI * Math.pow(radius, 2); DecimalFormat fmt = new DecimalFormat ("0.####"); System.out.println ("Volume: " + fmt.format(volume)); System.out.println ("Surface area: " + fmt.format(area)); } }