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

Help with java programming

  • 08-12-2005 11:40am
    #1
    Closed Accounts Posts: 992 ✭✭✭


    Hey all im a first year computing student adn iwas wondering if anyone can help me out. i have a few sample q's that i need doing but have no idea what to do. here are the q's.

    Write a method that determines whether a lowercase letter is a vowel or not. The method should take a character as a parameter and return a boolean value true if the character is a vowel and false otherwise.

    Write a method that will count the number of vowels in a word. The method will take a String representing a word and return an integer, the number of vowels in the word.

    Write a method which will take a word as a parameter and return the fraction of vowels in the word. For example, in a four letter word with one vowel the ratio is 0.25. This method should return a number of type double.

    A 'spam' word is defined as one in which the fraction of vowels is outside the range 0.01 to 0.9. Write a boolean method which takes a word as a parameter and determines if the word is a spam word or not.

    Write a method which takes a sentence as a parameter and counts the number of spam words in the sentence. The method should return this count as an integer.

    Can anyone help me out?


Comments

  • Registered Users, Registered Users 2 Posts: 21,264 ✭✭✭✭Hobbes


    mchurl wrote:
    Can anyone help me out?

    Is there still time to change to another class?

    Have you actually done any work yet? If so post it and point out what exactly it is you have an issue with. Also read the Charter and the FAQ Java part.


  • Registered Users, Registered Users 2 Posts: 42 cake126


    Ok, before you post here again, you really ahould read the charter and stuff about homework. You're not gonna get any code unless you give it a go yourself. The internet is full of it. Try some basic tutorials on java.sun.com.

    In answer to your questions, basically I'd try using the charAt() method and comparing it to the vowels. Try it out, write some code and if it doesn't work, post it and then you might be able to get some help.

    Best of luck.


  • Registered Users, Registered Users 2 Posts: 12 daresie


    You've got String objects, chars and if statements. Look up the basics on these, which should be in your course notes or the Java API.

    I don't want to cause offence but I've found from experience that the people who ask how to do every single problem without even making an attempt rarely learn anything. There's nothing wrong with finding programming difficult, I certainly did, but at least attempting the problems is vital. Either that, or reconsider your career path.


  • Registered Users, Registered Users 2 Posts: 2,528 ✭✭✭TomCo


    ****s sake, will you do the bloody lab and stop arsing around on the internet!


Advertisement