Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 6 of 6

Thread: How to write body methods

  1. #1
    Junior Member
    Join Date
    Oct 2012
    Posts
    15
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default How to write body methods

    I recently posted a similar post to this one. The reason why I'm posting this again is because an administrator told me to put [ highlight=Java] and [/highlight] to make my post more readable I hope this is what he meant. Please help me. I'm trying to get at least a B in this course.

    /**
    * A class to give students experience using loops. This class
    * creates and manipulates objects of Greg's Date class.
    */
    public class SpeedDating
    {
    // Note: this class has no instance variables!
     
    /**
    * Creates an empty SpeedDating object so that you can call the methods
    * (a constructor that takes no parameters is known as a "default"
    * constructor)
    */
    public SpeedDating()
    {
    } // Constructor has empty body
     
    /**
    * Prints the day of the week (e.g. "Thursday") on which Halloween will
    * fall for 10 consecutive years.
    * @param startYear the first of the 10 consecutive years
    */
    public void printHalloweens(int startYear)
    {
     
    // TO DO: write body of this method here
    }

    1.Create a SpeedDating object

    2.Have the user enter a year, and call the printHalloweens method to print the day of the week on which Halloween will occur for the next 10 years, starting with the input year

    3.Have the user enter another year, call the getThanksgiving method, and print the Date object returned. Print the Date in the main method, not in SpeedDating.

    4.Have the user enter another year, call getThanksgiving again, and print the Date object returned again.

    Right now I'm not worried about the test class. I just need some help in writing the methods. My assignment states specifically that loops must be used in order to get credit. If I can write the loops I'm pretty sure I can do the test class. Please someone help me.


  2. #2
    Grand Poobah
    Join Date
    Mar 2011
    Posts
    1,545
    My Mood
    Grumpy
    Thanks
    0
    Thanked 167 Times in 158 Posts

    Default Re: How to write body methods

    Completing the method body

    Duplicate post.
    Improving the world one idiot at a time!

  3. #3
    Junior Member
    Join Date
    Oct 2012
    Posts
    15
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default Re: How to write body methods

    how do I delete it?

  4. #4
    Super Moderator curmudgeon's Avatar
    Join Date
    Aug 2012
    Posts
    1,130
    My Mood
    Cynical
    Thanks
    64
    Thanked 140 Times in 135 Posts

    Default Re: How to write body methods

    Your question doesn't contain an answerable question, and as posted above is nothing more than a homework dump. Please ask something that we can answer.

  5. #5
    Super Moderator jps's Avatar
    Join Date
    Jul 2012
    Posts
    2,642
    My Mood
    Daring
    Thanks
    90
    Thanked 263 Times in 232 Posts

    Default Re: How to write body methods

    If you are expected to use a loop, I would assume you are expected to write code that does "the same basic thing" over and over again. What does the assignment say to do?
    I think if you start working on a solution to the problem the loop will become clear when you get that far.

  6. #6
    Junior Member
    Join Date
    Oct 2012
    Posts
    15
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default Re: How to write body methods

    Nvm got it! Thank you guys!
    Last edited by michael305rodri; November 5th, 2012 at 04:58 PM.

Similar Threads

  1. can any body help to correct this error
    By Diyaka in forum JDBC & Databases
    Replies: 1
    Last Post: July 25th, 2012, 01:37 PM
  2. hi every body!!!!!!!!!........
    By kranthi in forum Member Introductions
    Replies: 2
    Last Post: January 10th, 2012, 06:03 AM
  3. Hello every body
    By sireesha in forum Member Introductions
    Replies: 1
    Last Post: June 6th, 2011, 04:27 AM
  4. Write methods and constructors from Javadocs
    By smashX in forum What's Wrong With My Code?
    Replies: 3
    Last Post: April 20th, 2011, 10:23 PM
  5. Hi Every Body!
    By Xcube in forum Member Introductions
    Replies: 1
    Last Post: March 12th, 2011, 05:27 PM