The Artima Developer Community
Sponsored Link

Java Answers Forum
help with assignment!

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
lightsaber

Posts: 1
Nickname: lightsaber
Registered: Jul, 2002

help with assignment! Posted: Jul 14, 2002 10:09 PM
Reply to this message Reply
Advertisement
Hi all,

I'm having difficulty with this piece of work that I have been given. Would someone be kind enough to help me out or to do it for me or something as I have no idea. Here it is:

Create a Class named Year that contains a data field that holds the number of days in the year. Include a get method that displays the number of days and a constructor that sets the number of days to 365. Create the subclass named LeapYear. LeapYear?s constructor overrides Year?s constructor and sets the day field to 366. Write a program that instantiates one object of each class and displays each class? data.

Add a method named daysElapsed() to the Year class you created earlier. The daysElapsed() method accepts two arguments representing a month and a day; it returns an integer indicating the number of days that have elapsed since January 1 of the year. Create a daysElapsed() method for the LeapYear class that overrides the method in the Year class. Write a program that calculates the days elapsed on March 1 for a Year and for a LeapYear.


If anyone could please help me before the end of this week I would be very grateful.

Thanks a lot!

Topic: Converting an integer to string Previous Topic   Next Topic Topic: An image in a panel

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use