Skip to Main Content

New to Java

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to use Java.lang.Math to calculate; Advice programming

807598Jun 3 2006 — edited Jun 3 2006
Hi, all!
I am trying to teach myself Java, and am using the MindQ CDs to do it. I'm dreadfully stuck on this one exercise, and I could use some help figuring out how to properly call a Math method, store the variables, and print the results. I've programmed other methods successfully before; for some reason I just can't figure this one out. I've tried about fifty different configurations; maybe I can get some good advice here? Thanks!
import java.io.*;
import java.util.Random;
import java.lang.Math;

public class JavaCalcs {

    public static void main(String args[]) {
        System.out.println("Starting JavaComputations...");
        //main method variable declarations
        int z, y, x, w;
        int A = -12;
        int B = 2;

        z = A & B;
        y = A | B;
        x = A >> B;
        w = A >>> B;

        System.out.println(z + ";" + y + ";" + x + ";" + w + ";");

        Random kickassRNG = new Random();

        double rDOne = kickassRNG.nextDouble() * 90.0;
        double rDTwo = kickassRNG.nextDouble() * 90.0;
        System.out.println("rDOne= " + rDOne);
        System.out.println("rDTwo= " + rDTwo);
//NOTE-EVERYTHING WORKS FINE UNTIL THIS POINT...
        if (rDOne > rDTwo)
        System.out.println("The larger of the 2 degs. is rDOne");
        //compute ceiling.
        double a=rDOne; //Store the value of rDOne.
        public static double ceil(double a);
        return a;
        System.out.println( "the ceiling of rDOne is " + a );

        //convert degree measurement to radians.      
        public static double toRadians(double b);
        double b = a;
        System.out.println("rDOne in radians is " + b );

        //compute tangent of that result.
        public static double tan(double c);
        double c = b;
        System.out.println("The tangent of rDOne is " + c );
        
        else
        System.out.println("The larger of the 2 degs. is rDTwo");
               
        //compute ceiling.
        double a=rDTwo; //Store the value of rDOne.
        public static double ceil(double a);
        return a;
        System.out.println( "the ceiling of rDTwo is " + a );

        //convert degree measurement to radians.      
        public static double toRadians(double b);
        double b = a;
        System.out.println("rDTwo in radians is " + b );

        //compute tangent of that result.
        public static double tan(double c);
        double c = b;
        System.out.println("The tangent of rDTwo is " + c );

    } //end main method.
}
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 1 2006
Added on Jun 3 2006
11 comments
229 views