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
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Problem-Area Of A Triangle

  • 24-05-2012 5:44pm
    #1
    Registered Users, Registered Users 2 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: 41,230 Mod ✭✭✭✭Seth Brundle


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


  • Registered Users, Registered Users 2 Posts: 19 miguel2007


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


  • Registered Users, Registered Users 2 Posts: 7,834 ✭✭✭Brussels Sprout


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


  • Registered Users, Registered Users 2 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, Registered Users 2 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, Registered Users 2 Posts: 453 ✭✭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: 41,230 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, Registered Users 2 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