Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

A little help java

  • 21-01-2002 11:34AM
    #1
    Registered Users, Registered Users 2 Posts: 1,684 ✭✭✭


    yeah seamus tis grand now figured it out eventually. cheers mate..


Comments

  • Registered Users, Registered Users 2 Posts: 68,173 ✭✭✭✭seamus


    I'm not entirely sure what you mean, but to make it user-interfaceable(:confused: ) take out the main method, and just have a class MaxHeap, with all those other methods in it, then create a class TestHeap or sumfink, and write a main method with prompts etc in it, that invokes the methods in MaxHeap. (that is what you meant by kbd isn't it?). OK, that's not necessary, but it's good practice, afaik. Umm if you want to be able to define the values in the array heap, just put some sort of prompt like:

    Enter the values you want for an array. '.' to finish:

    And then make a while loop that adds each value into the array (testing it first of course! :)), and checks to see if a '.' was entered to signify end of input. This is what I'm assuming you meant btw. :)


Advertisement