Page 2 of 2 FirstFirst 12
Results 21 to 24 of 24
  1. #21
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default

    Quote Originally Posted by HaplessNoob View Post
    Sorry, i didn't mean to give the impression that i dumped your code into my program because i didn't. My actual assignment is actually nothing to do with dimensions :)

    What i did was merge your two examples together in an effort to see your code working is all.

    Like this:

    Java Code:
    public class Foo3 {     
       private static double count = 0;
       
    
    
       public static void main(String[] args) {
           double width = method1("Please enter a width");
           double height = method1("Please enter a height");
           double age = method1("Please enter an age");
    
          System.out.println("results are");
          System.out.println("a: " + width);
          System.out.println("b: " + height);
          System.out.println("c: " + depth);
       }
       
       private static double method1() {
          count++;
          return count;
       }
    
    
    }
    The first double in main is flagged with, "method1() in Foo3 cannot be applied to (java.lang.String)".
    Well, actually you did paste code that shouldn't be pasted. My method1 code example cannot be used in your program above, and your error is telling you why. You need a method that accepts a String parameter, and method1 has no parameter. You need a method in fact that prompts the user with the String parameter, probably by using a System.out.print(...), you need to get information back from the user in this method -- probably with a Scanner object, and then you need to return a double, and the code in method1 does none of this. You will need to write your own method for this.

    Also, you posted your code above in "quote" tags not "code" tags, and so I edited it and changed the tags.

  2. #22
    HaplessNoob is offline Member
    Join Date
    Jan 2011
    Posts
    14
    Rep Power
    0

    Default

    Woot, done it :)

    Funny, now that I can sit back and see how each method interacts the whole system of using them makes perfect sense. On reflection I probably shouldn't have really attempted this so soon, we clearly havn't been taught anything this advanced yet.

    Thanks for your help and patience Fubarable.

  3. #23
    HaplessNoob is offline Member
    Join Date
    Jan 2011
    Posts
    14
    Rep Power
    0

    Default

    I'd post up the code so you can finally see what the hell I've been going on about but i'm guessing that's poor form for any cheaters out there.

  4. #24
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

Page 2 of 2 FirstFirst 12

Similar Threads

  1. need for some advice
    By kasiopi in forum AWT / Swing
    Replies: 3
    Last Post: 01-26-2011, 12:36 PM
  2. Im new n looking for an advice
    By azlynn in forum New To Java
    Replies: 2
    Last Post: 12-10-2009, 02:47 AM
  3. [SOLVED] need advice on this method.
    By PureAwesomeness in forum New To Java
    Replies: 1
    Last Post: 02-24-2009, 06:22 AM
  4. Some advice please!
    By awebbtt in forum New To Java
    Replies: 3
    Last Post: 02-02-2009, 07:23 PM
  5. Advice on best method for....
    By shaungoater in forum Java 2D
    Replies: 1
    Last Post: 06-23-2008, 07:36 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •