Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.
Hi all, please see this major site announcement: https://www.boards.ie/discussion/2058427594/boards-ie-2026

A little help java

  • 21-01-2002 10: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