Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Problem-Area Of A Triangle

Options
  • 24-05-2012 6:44pm
    #1
    Registered Users Posts: 19


    I am new to java and learning. How do I write an application to calculate the area of a Triangle, where the area calculation is performed in a Triangle class not in the App class. Am at a loss with this one and what it means.
    Am using notepad++ .


Comments

  • Moderators, Politics Moderators Posts: 39,671 Mod ✭✭✭✭Seth Brundle


    College project?
    A quick google reveals loads of info on this.
    Maybe post your code so far.


  • Registered Users Posts: 19 miguel2007


    kbannon wrote: »
    College project?
    A quick google reveals loads of info on this.
    Maybe post your code so far


  • Registered Users Posts: 7,157 ✭✭✭Brussels Sprout


    If you're struggling with the maths have a look at this followed by this.


  • Registered Users Posts: 19 miguel2007


    Not a college project. Learning Java and am struggling. Maths part I am okay with but differentiating between app class and triangle class and writing the correct code for this.


  • Registered Users Posts: 7,157 ✭✭✭srsly78


    Well first write the app with just an App class. Copy a "hello world" bog-standard program for this. Instead of printing hello world, calculate the area and print that instead.

    That's step 1. Do that before you try to do a Triangle class.


  • Advertisement
  • Registered Users Posts: 446 ✭✭Ant


    miguel2007 wrote: »
    Not a college project.

    That's a coincidence. I had the exact same Java problem due for submission last Friday evening. :D

    I can't guess who you are from your Boards username but feel free to give me a shout as I wrote an intermediate command line version of the program which leaves out all the library code for the GUI windows so it's easier to see how the App() method interacts with the Triangle object.

    My Boards user name is simply the first 3 letters of my real name so now you know who I am.


  • Moderators, Politics Moderators Posts: 39,671 Mod ✭✭✭✭Seth Brundle


    If the OP is a student looking for an easy solution to a project then don't give them the source code. Let them learn how to do it! Otherwise, what's the point in a course exercise?


  • Registered Users Posts: 9,153 ✭✭✭everdead.ie


    I'd recommend just get it working inside the Main method first and then once you have this working you can look at moving it to a seperate class.


Advertisement