• Post Reply Bookmark Topic Watch Topic
  • New Topic

Increment Day Object Help  RSS feed

 
Simone Taylor
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Hi there. I'm new to this forum and Java. I'm currently taking a class in Java and was hoping someone could help me out. I'm stuck and I don't know what to do. Here is the question-

Write a program that generates a Day object
representing February 28 of this year, and three more such objects that represent
February 28 of the next three years. Advance each object by one day, and print each
object. Also print the expected values.
Expected Results
----------------
2015-02-28 + one day == 2015-03-01
Expected: 2015-3-1
2016-02-28 + one day == 2016-02-29
Expected: 2016-2-29
2017-02-28 + one day == 2017-03-01
Expected: 2017-3-1
2018-02-28 + one day == 2018-03-01
Expected: 2018-3-1

Any help would be greatly appreciated!
 
Raymond Tong
Ranch Hand
Posts: 255
2
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Simone Taylor wrote:
Write a program that generates a Day object
representing February 28 of this year

You need a Day object, and think what fields it should contains.
Simone Taylor wrote:Advance each object by one day

Day should have a method for you to advance by one day
Simone Taylor wrote:, and print each
object. Also print the expected values.

Day should have a method to print its current content
 
Junilu Lacar
Sheriff
Posts: 11494
180
Android Debian Eclipse IDE IntelliJ IDE Java Linux Mac Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Simone, Welcome to the Ranch!

Raymond has given some good hints. Please post what you have tried so far so we can give more guidance. When posting code, please UseCodeTags (← click on that link to learn how).
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!