Search:

Type: Posts; User: Scren

Page 1 of 3 1 2 3

Search: Search took 0.08 seconds.

  1. Replies
    53
    Views
    4,136

    Re: Splitting up main method / class

    sorry.... had my wisdom tooth removed yesterday and it's a bit controlling at the moment :mad:

    anyway!



    Of course, nice one.
  2. Replies
    53
    Views
    4,136

    Re: Splitting up main method / class

    posted early... editing now!
  3. Replies
    53
    Views
    4,136

    Re: Splitting up main method / class

    Right, is this in a way analogous to a folder system in a GUI? (I should probably stay away from using GUI as examples with this but it seemed to fit....) The highest most 'folder' (or parent class)...
  4. Replies
    53
    Views
    4,136

    Re: Splitting up main method / class

    Ah yeah of course...count from zero




    Yeah I left that blank for some reason...



    Cool - I've seen these method's with Strings as well I think.
  5. Replies
    53
    Views
    4,136

    Re: Splitting up main method / class

    FarmClass

    public class FarmClass {

    List<Animal> animalList = new ArrayList<Animal>();


    I've made that, but I'm struggling with everything else...
  6. Replies
    53
    Views
    4,136

    Re: Splitting up main method / class

    Ace... Times vanished in the UK, I should be able to read up on stuff and have a stab at this before work tomorrow though... :)
  7. Replies
    53
    Views
    4,136

    Re: Splitting up main method / class

    Ace, well here's the Animal class (I used Eclipse to generate the getters.... not sure if this is a not-to-do...):


    public abstract class Animal {

    public String sound;
    public String name;
    ...
  8. Replies
    53
    Views
    4,136

    Re: Splitting up main method / class

    Ace cheers mcgr - have read through the post a couple of times...

    So an interface - contain's all of the instance variables that are going to be used in further classes, If someone was making an...
  9. Replies
    53
    Views
    4,136

    Re: Splitting up main method / class

    Ah of course, that'll be the easier way to do that! Although typing exit



    Yes - I've seen this before with a continue statement, completely forgot about it... handy :)



    Ok cool - it...
  10. Replies
    53
    Views
    4,136

    Re: Splitting up main method / class

    I don't really see how the nested if statement can break out of the for loop? Because it's nested won't it just break out of the if statement back into the for loop etc...?

    OK wow I just tried it...
  11. Replies
    53
    Views
    4,136

    Re: Splitting up main method / class

    Just looking at this... going to have a bash. I think that I'm removing all the count int's and replacing them with this <list> interface. Going to try that now.

    --- Update ---

    Cool that's...
  12. Replies
    53
    Views
    4,136

    Re: Splitting up main method / class

    Not really - where has the userAnimal variable come from? or is that created by invoking that method?

    Ahhhh I see you've created a String variable then passed that into myFarm.promptUser();
    ...
  13. Replies
    53
    Views
    4,136

    Re: Splitting up main method / class

    Will try this now - I'm creating a main method separate to the FarmClass. I thought that the scanner in the promptUser() method of the FarmClass was capturing the users input..?

    Does this mean...
  14. Replies
    53
    Views
    4,136

    Re: Splitting up main method / class

    I'll have a bash at creating the other classes now.... I'll post back when I'm done!

    --- Update ---

    Ok I've made those...

    I'm still kind of waiting for the dot's to join up around the...
  15. Replies
    53
    Views
    4,136

    Re: Splitting up main method / class

    I think the version where the Scanner is integrated into the class and rather than the main method seem's more 'proper' for some reason? I really don't know though.





    OK, so I've put that...
  16. Replies
    53
    Views
    4,136

    Re: Splitting up main method / class

    cool.




    This seem's alright, though I'm not too sure how they will be set up, how the count's will be tracked. I'm guessing that pigCount will = 0 and be incremented by every creation of Pig. ...
  17. Replies
    53
    Views
    4,136

    Re: Splitting up main method / class

    No offence, I'm just surprised at my incapacity being brought into question! ;)
  18. Replies
    53
    Views
    4,136

    Re: Splitting up main method / class

    Really???



    Ha ok then let's try this....

    Parts that I think I'm going to need

    Main method - no explanation
  19. Replies
    53
    Views
    4,136

    Re: Splitting up main method / class

    The main priority with this is learn, so If someone was to say "you'd be much better off writing a program that list's farm yard animal's" then I'd go off and do that, I don't have any criteria to...
  20. Replies
    53
    Views
    4,136

    Re: Splitting up main method / class

    Hmm I'm looking at this again and I'm not sure what I'm doing to be honest (perhaps it was a bit of a leap....)

    I've written a class called Question and I've extended it to TablesTest..... I'm...
  21. Replies
    53
    Views
    4,136

    Re: Splitting up main method / class

    Right OK I've read through the example that you've posted:

    I'm not really that au fait with the arrays being used in the for loop, If I look at each bit individually it kind of makes sense but...
  22. Replies
    53
    Views
    4,136

    Re: Splitting up main method / class

    just going to read through that post, this is what I started with (before I delete it...)



    import java.util.Scanner;

    public class UserQuestion {

    public UserQuestion() {
  23. Replies
    53
    Views
    4,136

    Re: Splitting up main method / class

    cheers mcgr - I guess that I'll have two classes then. So there'll be

    1 : Main Method
    2 : Question Class
    3 : TimesTableQuestion class

    I wasn't sure if the TimesTQuestion class would have to...
  24. Replies
    53
    Views
    4,136

    Re: Splitting up main method / class

    Hey greg back from work (shifts suck...) and going to start this... I'm thinking that It would be best to start a project from scratch for it. New I think's best...

    I'm reading through what...
  25. Replies
    53
    Views
    4,136

    Re: Splitting up main method / class

    Hey Greg, just off to work myself :(

    But yes, I was thinking about making it into one the generated a problem instead of it being hard coded. Could be a multiplication table, or basic mixed...
Results 1 to 25 of 52
Page 1 of 3 1 2 3