Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 5 of 5

Thread: Solve the missing information of a triangle

  1. #1
    Junior Member
    Join Date
    Feb 2013
    Posts
    14
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Solve the missing information of a triangle

    Hello everyone, I'm taking an introductory programming class right now and having a problem with one assignment.

    We were asked to write a program that would solve for the missing information on:part a) an oblique triangle ; part b) a right triangle
    given that the user will input 3 informations (side or angle)
    I'm having a problem of how to start off this program
    How do I create a user input that will allow me to let the user to enter in 3 informations and this is important : if they don't enter in 3 informations, I'm suppose to tell them that extra information is needed.

    Also, for the process, should I use nested loops? for loops? while loops, if statement or switch statement?

    Please help, I am very struggling here.

    Thank you.


  2. #2
    Super Moderator curmudgeon's Avatar
    Join Date
    Aug 2012
    Posts
    1,130
    My Mood
    Cynical
    Thanks
    64
    Thanked 140 Times in 135 Posts

    Default Re: Solve the missing information of a triangle

    Answer: "yes".

    Try whatever you think might work, experiment with different approaches, then modify your code, play with your code, go hog wild with your code. You can't break anything by doing this and will have much to gain.

  3. #3
    Junior Member
    Join Date
    Feb 2013
    Posts
    14
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Re: Solve the missing information of a triangle

    Is it possible if you could provide me a hint?

  4. #4
    Junior Member
    Join Date
    Feb 2013
    Location
    Nairobi, Kenya
    Posts
    2
    My Mood
    Happy
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Solve the missing information of a triangle

    When I was starting, I used to bombard forums with such questions because this things really looked hard. And I always got the same reply...."get a book", "research", "try out and note down your mistakes". "Do what you think will work and not what you hope will work". "Dont make a mistake that is obviously a mistake". And now I can help you code this thing in 5 minutes. but I wont coz that will be unfair to you as you wont learn. but ill give you a hint that I was given about a year ago when I started programming that drove me nuts but made me want to learn more.

    class GetABook
    {
    //get a book and input whatever practices you learn here
    }

    im not brushing you off and I know it sucks not getting a response you had hoped for but one year down the line, maybe you will appreciate this as well. Oh and when you have some code, just throw it in here and trust me, help will come flooding to you.

  5. #5
    Super Moderator curmudgeon's Avatar
    Join Date
    Aug 2012
    Posts
    1,130
    My Mood
    Cynical
    Thanks
    64
    Thanked 140 Times in 135 Posts

    Default Re: Solve the missing information of a triangle

    I would recommend that you first write out the typical interactions that you want your program to have with the user including how the interaction would look if the user entered inadequate information, then use this script to help you write out pseudo-code a basic structure for your program. Only then write out the Java. The key here being you need to first understand your problem before you can even consider the code.

Similar Threads

  1. Replies: 0
    Last Post: February 1st, 2013, 12:25 PM
  2. need help with a mumbers triangle
    By umairbaloch in forum What's Wrong With My Code?
    Replies: 7
    Last Post: December 16th, 2012, 10:05 AM
  3. [HELP] TRIANGLE!
    By kramista in forum Loops & Control Statements
    Replies: 10
    Last Post: July 29th, 2010, 12:58 PM
  4. ASCII Triangle
    By physics in forum Loops & Control Statements
    Replies: 1
    Last Post: March 27th, 2010, 06:39 AM
  5. Triangle issues
    By FrEaK in forum What's Wrong With My Code?
    Replies: 0
    Last Post: February 24th, 2010, 08:49 AM