Thread: Trigonometry Calculations Assignment help

  1. #1
    Registered User
    Join Date
    May 2013
    Posts
    2

    Trigonometry Calculations Assignment help

    Hello ya’ll! I need your help to help me with my assignment. Just like the previous assignment, I have an extremely difficult time completing all of my HW so far because, 1, the instructor is horrible, and 2, I’m actually in a high level Computer Science class since Computer Science l states’ specially it’s an introduction course to Computer Science. I was actually supposed to enroll in Exploring Computer Science first but I did not see that as an option until it was already too late. Anyways, I hoping if you can figure this out one for me and I’ll use the same formula for my codes and won’t use the one’s I have not learned yet in class. By the way, I have never taking Trigonometry so I have no idea where to start.

    For this assignment, you will be calculating the hypotenuse and standard trigonometric values (sine, cosine, tangent), and cotangent for a right triangle of arbitrary size. Your program will start by asking the user for the lengths of the adjacent and opposite sides of a right triangle. Then your program will do the calculations for the items listed above, and display the results. The calculation to find the hypotenuse is:

    hypotenuse 2 = opposite 2 + adjacent 2 , or hypotenuse = sqrt(opposite 2 + adjacent 2)

    You can use the <cmath> library to get access to the pow() and sqrt() functions.

    The calculation for sine, cosine, tangent, and cotangent are as follows:



    View image: test



    I want your program to ask if the user would like to do another calculation. If the user says “yes,” then ask them for the adjacent and opposite sides of a triangle again, and do the calculations again. You can put the relevant code inside of a while or do-while loop to do this.


    Sample Output

    Welcome to Rob's trigonometry calculator.
    Please tell me the lengths of the adjacent and opposite sides of a right triangle.
    Adjacent side length: 1.2
    Opposite side length: 3.4
    Based on an adjacent side of 1.2 and an opposite side of 3.4,
    the hypotenuse has length 3.60555.
    The sine of the angle is 0.94299.
    The cosine of the angle is 0.33282.
    The tangent of the angle is 2.83333.
    The cotangent of the angle is 0.352941.

    Would you like to do another calculation? (Y or N): Y
    Adjacent side length: 2.5
    Opposite side length: 1.7
    Based on an adjacent side of 2.5 and an opposite side of 1.7,
    the hypotenuse has length 3.02324.
    The sine of the angle is 0.56231.
    The cosine of the angle is 0.826927.
    The tangent of the angle is 0.68.
    The cotangent of the angle is 1.47059.

    Would you like to do another calculation? (Y or N): N

    Design Considerations
    You will need the <cmath> library to have access to pow() and sqrt(). Please check for division by zero; don’t rely on the compiler to catch a divide by zero error. You will lose points on the assignment if your program allows division by zero, so check for zero before doing division. Follow the style guide for all of your relevant code items, including proper indentation, variable names, etc. Do not use literal values in your calculations; use constant globals instead. For example:
    const double DEGREES_PER_RADIAN = 57.296;

  2. #2
    Registered User
    Join Date
    May 2010
    Posts
    4,632
    So where is your code, that show you're actually trying to accomplish your goals?

    Also this same question is posted here.



    Jim
    Last edited by jimblumberg; 05-04-2013 at 02:02 PM.

  3. #3
    Registered User
    Join Date
    May 2013
    Posts
    2
    [QUOTE=jimblumberg;1161437]So where is your code, that show you're actually trying to accomplish your goals?

    Also this same question is posted here.



    I know I posted there as well but I'm just trying to get a quick response so I can get started on my Assignment. The code I have so far (which is most likely wrong) is:#include<iostream>
    #include<iomanip>
    #include<string>
    usingnamespace std;
    constdouble Adjacentleg = 1.2;
    constdouble Oppositeleg = 3.4;
    constdouble Hypotenuse = 3.6;
    int main()
    {
    cout << fixed << showpoint << setprecision(2);
    cout << "Welcome to Jerry's trigonometry calculator!" << endl;
    cout << "Please tell me the lengths of the adjacent and opposite sides of a right triangle? ";
    cout << "Enter q to quit...";
    cin >> reply;

    return 0;
    }

  4. #4
    Registered User
    Join Date
    May 2010
    Posts
    4,632
    I know you know you posted this question in multiple forums, I'm just informing others of this rude behavior.

    You'll get much faster response once you actually start coding your program, post the code, and ask specific questions about the code you provided. No one here will take your assignment dump and do the work for you. Stop procrastinating and get to work. If you don't think you're capable of completing the assignment I suggest you talk to your instructor and try to get a transfer into a more suitable course.

    Jim

  5. #5
    Registered User
    Join Date
    Aug 2010
    Location
    Poland
    Posts
    733
    Quote Originally Posted by Junomaster2006 View Post
    By the way, I have never taking Trigonometry so I have no idea where to start.
    Then I suggest you to start from learning the basis of trigonometry.

    Quote Originally Posted by Junomaster2006 View Post
    I know I posted there as well but I'm just trying to get a quick response so I can get started on my Assignment. The code I have so far (which is most likely wrong) is:
    Good, we've got your code. Now we only need you to ask questions regarding the code you posted.

  6. #6
    Registered User
    Join Date
    Jun 2005
    Posts
    6,815
    Quote Originally Posted by Junomaster2006 View Post
    I know I posted there as well but I'm just trying to get a quick response so I can get started on my Assignment.
    Firstly, posting on multiple forums is the most effective way to maximise chances you will NOT get help. Not because people object to participation in multiple forums. But because it is clear that asking the same question in multiple posting is a lazy approach that people use INSTEAD of doing one's own homework.

    Second, your teacher has provided all of the information you need to do YOUR homework (in fact, the question gives you MORE information than you need). People can recognise this whether or not you post on multiple forums (real-world problems have a different character than homework problems, so people who can answer your question can tell the difference). From the way you have asked your question, the only way to give you a useful response would be for someone else to do your homework for you.

    Third, most forum sites have a homework policy (this site's policy is here, BTW). Even if sites do not have such an articulated policy, experienced members of forums see EXACTLY your approach on an almost daily basis, and respond as if such a policy was in place. The reason is simple: the purpose of homework is for you to learn by doing, and that won't happen if someone else does your homework for you.

    In conclusion .....

    DO YOUR OWN HOMEWORK.
    Right 98% of the time, and don't care about the other 3%.

    If I seem grumpy or unhelpful in reply to you, or tell you you need to demonstrate more effort before you can expect help, it is likely you deserve it. Suck it up, Buttercup, and read this, this, and this before posting again.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. hey real amateur needs help with trigonometry function
    By altec in forum C++ Programming
    Replies: 13
    Last Post: 10-05-2010, 10:13 AM
  2. Replies: 10
    Last Post: 03-28-2010, 01:35 AM
  3. Trigonometry Sin rule calculation problem
    By Harry in forum C++ Programming
    Replies: 3
    Last Post: 02-06-2006, 12:14 PM
  4. Basic Trigonometry Question
    By xddxogm3 in forum A Brief History of Cprogramming.com
    Replies: 19
    Last Post: 01-28-2005, 01:45 AM
  5. Trigonometry problem
    By McYaballow in forum C++ Programming
    Replies: 2
    Last Post: 07-09-2004, 01:11 AM