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

java help:)

  • 09-04-2010 1:25am
    #1
    Registered Users, Registered Users 2 Posts: 310 ✭✭


    hey guys can someone give me a hand with this assignment :)

    [FONT=Trebuchet MS, sans-serif]Complete the following class:[/FONT]


    [FONT=Courier New, monospace]class TestWordListMethods[/FONT]
    [FONT=Courier New, monospace]{[/FONT]
    [FONT=Courier New, monospace]private WordList wl = new WordList();[/FONT]

    [FONT=Courier New, monospace]public static void main(String args[])[/FONT]
    [FONT=Courier New, monospace]{[/FONT]
    [FONT=Courier New, monospace]new TestWordListMethods();[/FONT]
    [FONT=Courier New, monospace]} [/FONT]
    [FONT=Courier New, monospace]// Default Constructor[/FONT]
    [FONT=Courier New, monospace]public TestWordListMethods()[/FONT]
    [FONT=Courier New, monospace]{[/FONT]
    [FONT=Courier New, monospace]String longestWord = findLongestWord();[/FONT]
    [FONT=Courier New, monospace]String longestWordA = findLongestWordStartingWith('v');[/FONT]
    [FONT=Courier New, monospace]int averageLetters = findAverageNumberOfLetters();[/FONT]
    [FONT=Courier New, monospace]char mostCommon = findMostCommonLetter();[/FONT]
    [FONT=Courier New, monospace]String[] anagrams = findAllAnagrams("retains");[/FONT]
    [FONT=Courier New, monospace]System.out.println("The longest word is " + longestWord);[/FONT]
    [FONT=Courier New, monospace]System.out.println("The longest word starting with 'v' is " + longestWordA);[/FONT]
    [FONT=Courier New, monospace]System.out.println("The average number of letters is " + averageLetters);[/FONT]
    [FONT=Courier New, monospace]System.out.println("The most common letter is " + mostCommon); [/FONT]
    [FONT=Courier New, monospace]for(int i = 0; i < anagrams.length; i++)[/FONT]
    [FONT=Courier New, monospace]{[/FONT]
    [FONT=Courier New, monospace]System.out.println(anagrams + " is an anagram of retains");[/FONT]
    [FONT=Courier New, monospace]}[/FONT]
    [FONT=Courier New, monospace]} [/FONT]
    [FONT=Courier New, monospace]private String findLongestWord()[/FONT]
    [FONT=Courier New, monospace]{[/FONT]
    [FONT=Courier New, monospace]return null;[/FONT]
    [FONT=Courier New, monospace]}[/FONT]

    [FONT=Courier New, monospace]private String findLongestWordStartingWith(char c)[/FONT]
    [FONT=Courier New, monospace]{[/FONT]
    [FONT=Courier New, monospace]return null;[/FONT]
    [FONT=Courier New, monospace]}[/FONT]

    [FONT=Courier New, monospace]private int findAverageNumberOfLetters()[/FONT]
    [FONT=Courier New, monospace]{[/FONT]
    [FONT=Courier New, monospace]return 0;[/FONT]
    [FONT=Courier New, monospace]}[/FONT]

    [FONT=Courier New, monospace]private char findMostCommonLetter()[/FONT]
    [FONT=Courier New, monospace]{[/FONT]
    [FONT=Courier New, monospace]return ' ';[/FONT]
    [FONT=Courier New, monospace]}[/FONT]

    [FONT=Courier New, monospace]private String[] findAllAnagrams(String word)[/FONT]
    [FONT=Courier New, monospace]{[/FONT]
    [FONT=Courier New, monospace]return null;[/FONT]
    [FONT=Courier New, monospace]}[/FONT]

    [FONT=Courier New, monospace]}[/FONT]
    Tagged:


Comments

  • Registered Users, Registered Users 2 Posts: 6,236 ✭✭✭Idleater


    Can someone help you? Yes. What is the nature of the problem that you are having?
    A lot of your methods appear to only be skeleton code.
    You should probably begin with populating those. The method names do appear to hint at the desired function that the method is to provide.


  • Registered Users, Registered Users 2 Posts: 3,078 ✭✭✭onemorechance


    You can probably use the class java.lang.String to do most of what is required.

    http://java.sun.com/javase/6/docs/api/java/lang/String.html


  • Closed Accounts Posts: 5,482 ✭✭✭Kidchameleon


    theres lotts of methods in the string class that will help you populate these skeleton methods. check the java docs on sun micro systems website.


  • Registered Users, Registered Users 2 Posts: 3,078 ✭✭✭onemorechance


    theres lotts of methods in the string class that will help you populate these skeleton methods. check the java docs on sun micro systems website.

    "That's what she said!"


Advertisement