- #1
Hypnos_16
- 153
- 1
I apologize in advance for two things
1) If this is in the wrong section, and there's somewhere specific for Computer Science homework questions
2) how long this is going to be.
I'm a first year comp-sci student, we just recently learned about if else, while, do-while, for stuff like that, anyway, on this assignment i got there's a question with about 9 parts, and it's not that i need help writing the code, it's just i need help with clarification. Cause it seems really long winded and kind of redundant. So anything will help. I'll number the parts to make it easier.
2. Write, test and document (internally and externally) a Java program to solve the following problem:
Write a Java class named Month. The class should have an int attribute named monthNumber that holds the number of the month. For example, January would be 1, February would be 2, and so forth. In addition, provide the following methods:
a. A no-argument constructor that sets the monthNumber field to 1.
b. Notes on Documentation (follow the link listed under "Links")
c. A constructor that accepts the number of the month as an argument. It should set the monthNumber field to the value passed as the argument. If a value less than 1 or greater than 12 is passed, the constructor should set monthNumber to 1.
d. A constructor that accepts the name of the month, such as “January” or “February” as an argument. It should set the monthNumber field to the correct corresponding value.
e. A setMonthNumber method that accepts an int argument, which is assigned to the monthNumber field. If a value less than 1 or greater than 12 is passed, the method should set monthNumber to 1.
f. A getMonthNumber method that returns the value in the monthNumber field.
g. A getMonthName method that returns the name of the month. For example, if
the monthNumber field contains 1, then this method should return “January”.
h. An equals method that accepts a Month object as an argument. If the argument object holds the same data as the current object, this method should return true.
Otherwise, it should return false.
i. A greaterThan method that accepts a Month object as an argument. If the
current object’s monthNumber field is greater than the argument’s monthNumber field, this method should return true. Otherwise, it should return false.
j. A lessThan method that accepts a Month object as an argument. If the current object’s monthNumber field is less than the argument’s monthNumber field, this method should return true. Otherwise,it should return false.
That's all ONE question, so again, i apologize i can't be of more help, but if anyone could even help with the first couple, it might fall into place. I'm a first year student so it can't be that difficult i imagine. But it would be amazing if you could maybe summarize each step, in an easier way. Something. Again thank you for an input.
1) If this is in the wrong section, and there's somewhere specific for Computer Science homework questions
2) how long this is going to be.
I'm a first year comp-sci student, we just recently learned about if else, while, do-while, for stuff like that, anyway, on this assignment i got there's a question with about 9 parts, and it's not that i need help writing the code, it's just i need help with clarification. Cause it seems really long winded and kind of redundant. So anything will help. I'll number the parts to make it easier.
2. Write, test and document (internally and externally) a Java program to solve the following problem:
Write a Java class named Month. The class should have an int attribute named monthNumber that holds the number of the month. For example, January would be 1, February would be 2, and so forth. In addition, provide the following methods:
a. A no-argument constructor that sets the monthNumber field to 1.
b. Notes on Documentation (follow the link listed under "Links")
c. A constructor that accepts the number of the month as an argument. It should set the monthNumber field to the value passed as the argument. If a value less than 1 or greater than 12 is passed, the constructor should set monthNumber to 1.
d. A constructor that accepts the name of the month, such as “January” or “February” as an argument. It should set the monthNumber field to the correct corresponding value.
e. A setMonthNumber method that accepts an int argument, which is assigned to the monthNumber field. If a value less than 1 or greater than 12 is passed, the method should set monthNumber to 1.
f. A getMonthNumber method that returns the value in the monthNumber field.
g. A getMonthName method that returns the name of the month. For example, if
the monthNumber field contains 1, then this method should return “January”.
h. An equals method that accepts a Month object as an argument. If the argument object holds the same data as the current object, this method should return true.
Otherwise, it should return false.
i. A greaterThan method that accepts a Month object as an argument. If the
current object’s monthNumber field is greater than the argument’s monthNumber field, this method should return true. Otherwise, it should return false.
j. A lessThan method that accepts a Month object as an argument. If the current object’s monthNumber field is less than the argument’s monthNumber field, this method should return true. Otherwise,it should return false.
That's all ONE question, so again, i apologize i can't be of more help, but if anyone could even help with the first couple, it might fall into place. I'm a first year student so it can't be that difficult i imagine. But it would be amazing if you could maybe summarize each step, in an easier way. Something. Again thank you for an input.