Sep 06, 2006 08:40
// Elizabeth Bosch
// AP Computer Science
// Date:
// Description:
//
import java.util.*;
public class Program2_13
{
public static void main(String[] args)
{
Random generator = new Random();
int areaCode, prefix, number;
areaCode = generator.nextInt(899) + 100;
System.out.println("Area Code = " + areaCode);
prefix = generator.nextInt(899) + 100;
System.out.println("Prefix = " + prefix);
number = generator.nextInt(10000);
System.out.println("Number = " + number);
System.out.println ("Phone Number = " + areaCode + "-" + prefix + "-" + number);
}
}
// Elizabeth Bosch
// AP Computer Science
// Date: September 5, 2006
// Description: Read the radius of a
// sphere and prints its volume and suface area
//
import java.util.*;
public class Project2_9
{
public static void main(String[] args)
{
Scanner scan = new Scanner(System.in);
double volume;
double surfacearea;
double radius;
System.out.print("Enter radius: ");
radius = scan.nextDouble();
volume = ((Math.PI * radius * Math.pow(radius, 3) * 3) / 4);
System.out.println("Volume = " + volume);
surfacearea = (4 * Math.PI * radius * Math.pow(radius, 2));
System.out.print("Surface area = " + surfacearea);
}
}
fun fun fun in ap comp