Results 1 to 4 of 4
  1. #1
    pagunston is offline Member
    Join Date
    Apr 2011
    Posts
    2
    Rep Power
    0

    Default Please help with methods

    Hey guys,

    I am new to java and I am creating an applet for an assignment for my university course.

    I am trying to do some calculations inside a method but I am getting errors:

    private double Calculate_Results ()
    {
    return (ElectricityUsedPerYear = SunlightHours * DaysInYear * OutputCapacity / 1000.0);
    (ElectricityValue = ElectricityPrice * ElectricityUsedPerYear);
    (Efficiency = OutputCapacity / (1000.0 * ProductSize) * 100.0;)
    }// private double Calculate_Results ()
    How do I do all three calculations??? It only lets me do one calculation inside the method.

    Thanks,

    pagunston

  2. #2
    pagunston is offline Member
    Join Date
    Apr 2011
    Posts
    2
    Rep Power
    0

    Default

    P.S anyone know how to disable smile in my code?

  3. #3
    Junky's Avatar
    Junky is offline Grand Poobah
    Join Date
    Jan 2011
    Location
    Dystopia
    Posts
    3,798
    Rep Power
    7

    Default

    In future if you get errors then include them in your post.

    A method can only return one thing.

    If you place your code inside code tags instead of quote tags then it will not interpret the smilies. Place [ code ] before and [ /code ] after your code (without the spaces).

  4. #4
    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 pagunston View Post
    P.S anyone know how to disable smile in my code?
    Yes, use code tags around posted code, not quote tags.

    i.e., this:

    [code] -- start code tag
    [/code] -- end code tag


    not this:
    [quote] -- start quote tag
    [/quote] -- end quote tag

Similar Threads

  1. Replies: 8
    Last Post: 04-16-2012, 11:00 PM
  2. methods
    By blueduiker in forum New To Java
    Replies: 12
    Last Post: 02-09-2010, 03:50 PM
  3. Help with get and set methods
    By shroomiin in forum New To Java
    Replies: 4
    Last Post: 11-23-2009, 08:04 PM
  4. Help with Methods Please :-)
    By jkhamler in forum New To Java
    Replies: 22
    Last Post: 11-10-2009, 08:54 PM
  5. Replies: 4
    Last Post: 04-03-2009, 06:36 AM

Tags for this Thread

Posting Permissions

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