Search:

Type: Posts; User: ShakeyJakey

Search: Search took 0.21 seconds.

  1. Replies
    7
    Views
    1,374

    Re: Help with Arrays - Counting elements

    Sorry but I'm still unsure as to how to keep going through the array and checking if a word is unique or not. All i know is that it's probably done in the for loop below with the question marks....
  2. Replies
    7
    Views
    1,374

    Re: Help with Arrays - Counting elements

    haha it would seem ive totally misinterpreted the question. I'm such a noob. Sorry for wasting your time

    Im gonna attempt it now, knowing what a distinct word actually is. I'll keep this thread...
  3. Replies
    7
    Views
    1,374

    Re: Help with Arrays - Counting elements

    Count is 9. Its a distinct word if there is more then one letter. Im aware i havnt completely solved the question as i need an array. But how do I use one in a loop to check each word I enter to see...
  4. Replies
    7
    Views
    1,374

    Help with Arrays - Counting elements

    Hello everyone hows it going :)

    I've only recently been introduced to arrays and require a bit of help with a small exercise I was doing earlier. Here is the question :

    Write a program which...
  5. Replies
    16
    Views
    1,564

    [SOLVED] Re: Help with classes & instance methods

    Well i would have, but the question stated that no constructor is needed
  6. Replies
    16
    Views
    1,564

    [SOLVED] Re: Help with classes & instance methods

    Instead of making a seperate thread for a similar question I thought id post it here. Could anybody explain what a default constructor is? Heres the question:

    Write a class called Item to...
  7. Replies
    16
    Views
    1,564

    [SOLVED] Re: Help with classes & instance methods

    Oh I see what you mean now, sorry. After doing part (ii), I had to remove the I/O from the class anyway so I understand now :) Thanks
  8. Replies
    16
    Views
    1,564

    [SOLVED] Re: Help with classes & instance methods

    But the question stated that there is no need to create a constructor. And the whole point of the get() method is to prompt for sizes, because part (ii) of the question is to use this class in a...
  9. Replies
    16
    Views
    1,564

    [SOLVED] Re: Help with classes & instance methods

    Thanks for the help I solved it in the end, taking into account what you all suggested. Here's the solution for those interested :)

    class Rectangle
    {
    private int length;
    private int height;
    ...
  10. Replies
    16
    Views
    1,564

    [SOLVED] Re: Help with classes & instance methods

    Yes its just to determine if a rectangle is a square. There are no other shapes involved in the question.
    I dont think I defined them, I just created them in the get() method that would be read...
  11. Replies
    16
    Views
    1,564

    [SOLVED] Re: Help with classes & instance methods

    So you're saying i should have something like this:




    public static boolean isSquare(Rectangle r)
    {
    if(l==h)
    {
    System.out.println("Square");
  12. Replies
    16
    Views
    1,564

    [SOLVED] Help with classes & instance methods

    Hi everyone,

    Im still fairly new to java and i've gotten stuck on a small part of exercise. Could anybody help me? Heres the question relating to this section:

    Write a class to encapsulate the...
  13. Replies
    9
    Views
    2,070

    [SOLVED] Re: Help with Class Methods(Probably simple)

    I know, I didnt use that, I used the first method. I only posted it to show how I would get the same answer as the previous method. Because the question stated the method to be in the form num =...
  14. Replies
    9
    Views
    2,070

    [SOLVED] Re: Help with Class Methods(Probably simple)

    Yea i only read that after i used the first method. This is how i done it the other way


    import java.math.*;

    class PowersAlt{
    static int pow(int num, int power){
    int x =...
  15. Replies
    9
    Views
    2,070

    [SOLVED] Re: Help with Class Methods(Probably simple)

    Thanks alot i solved it just there with all of your help :) It was just a small question out of an exercise sheet that confused me and I hate moving on and leaving questions unsolved. Incase you were...
  16. Replies
    9
    Views
    2,070

    [SOLVED] Re: Help with Class Methods(Probably simple)

    Thanks for your reply :). Ive tried working it by what you've said. This is what i have so far


    class Powers{
    static int getPower(int num, int power){
    if(power==1){
    num = num;
    }...
  17. Replies
    9
    Views
    2,070

    [SOLVED] Help with Class Methods(Probably simple)

    Jake here, im new to this forum, im also new to java and recently got a bit stuck in a programming exercise for my module. I know it'll probably be really easy to some people but i thought id share...
Results 1 to 17 of 19