SphereCalculations

SphereCalculations - public static void main (String args)...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
//******************************************************************** // SphereCalculations.java Author: Lewis and Loftus // // Solution to Programming Project 2.9 //******************************************************************** / import java.util.Scanner; i public class SphereCalculations { //----------------------------------------------------------------- // Computes the volume and surface area of a sphere given its // radius. //-----------------------------------------------------------------
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: public static void main (String args) { double radius, area, volume; Scanner sc = new Scanner(System.in); System.out.print ("Enter the sphere's radius: "); radius = sc.nextDouble(); volume = 4.0 / 3.0 * Math.PI * Math.pow(radius, 3); area = 4 * Math.PI * Math.pow(radius, 2); System.out.println ("Volume: " + volume); System.out.println ("Surface area: " + area); } }...
View Full Document

This note was uploaded on 05/17/2011 for the course COP 3530 taught by Professor Davis during the Spring '08 term at University of Florida.

Ask a homework question - tutors are online