L01
Test.java
/**
* Print the Answer to Life, the Universe, Everything.
*
* @author Brandon
* @version 1/1/1990
*/
public class Test {
static int answer1 = 0;
static int answer2;
static int theAnswer;
public static void main(String[] args) {
answer1 = 20;
answer2 = 2 * answer1;
theAnswer = answer2 + 2;
System.out.println("The answer is...");
System.out.println(theAnswer);
}
}
ComputeCA.java
public class ComputeCA {
public static void main(String[] args) {
double radius = 4.5;
double circumference = 22.0 / 7.0 * radius;
double area = 22.0 / 7.0 * radius * radius;
System.out.println("Circumference: " + circumference);
System.out.println("Area: " + area);
}
}
No Comments