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.
Code Java:
/**
* 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.
Re: How to write body methods
Re: How to write body methods
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.
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.
Re: How to write body methods
Nvm got it! Thank you guys!