Results 1 to 3 of 3

Thread: trig question

  1. #1
    jayti is offline Member
    Join Date
    Oct 2010
    Posts
    5
    Rep Power
    0

    Default trig question

    hey im new to java and have to write a program which outputs the following:

    Enter the distance between the trig points: 1245
    Enter the angle from trig point 1: 34
    Enter the angle from trig point 2: 78

    The distance from point 1 is 1313.43 metres.
    The distance from point 2 is 750.87 metres.



    and i dnt really knw how to use math class: i hv done the following

    import java.util.Scanner;

    public class Ques1
    {

    public static void main(String[] args)
    {
    Scanner scan = new Scanner(System.in);
    int distance, angle_1, angle_2;
    double lenght_1, lenght_2;
    // distance is the distance between the two Trig points (f)//
    // angle_1 is the Trig point 1 (T1)//
    // angle_2 is the Trig point 1 (T2)//

    System.out.print("Enter the distance between the trig points: ");
    distance = scan.nextInt();

    System.out.print("Enter the angle from trig point 1: ");
    angle_1 = scan.nextInt();

    System.out.print("Enter the angle from trig point 2: ");
    angle_2 = scan.nextInt();

    }
    }

    could anybody plz tell me how to use th Math.PI and sin for this question.

    i knw my question sounds really silly, but plz try n help!!!

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,315
    Blog Entries
    1
    Rep Power
    26

    Default

    Could you edit your post above to change the abbreviations to standard English? It's hard to read especially for our non-native English speakers. Thanks.

  3. #3
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,771
    Blog Entries
    7
    Rep Power
    21

    Default

    For any triangle with sides A, B and C and opposite angles a, b and c the following equation holds: sin(a)/A == sin(b)/B == sin(c)/C. You know the angles a and b so c= 180-a-b (in degrees). You also know the length of two of the sides so that is enough to calculate the length of the other side.

    kind regards,

    Jos

Similar Threads

  1. Question mark colon operator question
    By orchid in forum Advanced Java
    Replies: 9
    Last Post: 12-19-2010, 09:49 AM
  2. Question about what this do.
    By Syfer in forum New To Java
    Replies: 1
    Last Post: 07-03-2010, 09:35 AM
  3. [SOLVED] Simple Trig Thing
    By AndrewM16921 in forum New To Java
    Replies: 4
    Last Post: 05-16-2009, 07:45 AM
  4. Using the Math Trig Methods
    By Java Tip in forum java.lang
    Replies: 0
    Last Post: 04-16-2008, 11:54 PM
  5. JNI question
    By javaplus in forum New To Java
    Replies: 0
    Last Post: 12-24-2007, 11:18 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •