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 4 of 4

Thread: What does this question mean?

  1. #1
    Junior Member
    Join Date
    Sep 2012
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default What does this question mean?

    So this is my assignment and I am having trouble trying to understand this question in part a, basically the part b is calculating area of a triangle which is tied up with the part a, the main issue is that I have declared the double variable for a,b and c but the logic of settng the sides and then making sure that the sum of any two sides should be greater than the third one. How to do this?

    (a) Write a Java class InvalidValueException. Objects of this class, when created, will
    show a simple message informing you of the nature of the exception thrown.

    (b) Given three straight lines a, b & c. They will be able to form a triangle provided that sum
    of any two lines is always greater than the third line (i.e. a + b > c and b + c > a and a + c
    > b).
    Write a Java class Triangle with the following:
    „h Attributes: length of the three sides of the triangle
    „h Behaviour:
    - Constructor that sets the length of the three sides to the values passed in. The
    constructor should throw an InvalidValueException object when the values
    are not able to form a triangle.
    - findArea() method to calculate the area of the Triangle object using the
    formula
    area = s * (s ƒ{ a) * (s ƒ{ b) * (s ƒ{ c) where s =
    2
    a ƒy b ƒy c


  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,165
    Thanks
    65
    Thanked 2,725 Times in 2,675 Posts

    Default Re: What does this question mean?

    making sure that the sum of any two sides should be greater than the third one.
    I guess you'd add together two of the sides and compare the results to the third side.
    Do that for each possible pair of sides.
    If you don't understand my answer, don't ignore it, ask a question.

  3. #3
    Junior Member
    Join Date
    Sep 2012
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: What does this question mean?

    Quote Originally Posted by Norm View Post
    I guess you'd add together two of the sides and compare the results to the third side.
    Do that for each possible pair of sides.
    wat about the part a? (texting habit hehe)
    Last edited by jackandjill; September 26th, 2012 at 10:50 AM.

  4. #4
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,165
    Thanks
    65
    Thanked 2,725 Times in 2,675 Posts

    Default Re: What does this question mean?

    wat abt
    Is there something wrong with your keyboard? Your last post is messed up.
    If you don't understand my answer, don't ignore it, ask a question.

Tags for this Thread