This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Date CLass Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Date CLass" Watch "Date CLass" New topic
Author

Date CLass

Bill Ballou
Greenhorn

Joined: Jun 17, 2007
Posts: 2
I hope this is the right place for this. Ok I am studying for a final test in my java class (groan). I have been trying to run through all of the codes in chapter 8 of Java How to Program 6th edition and I have hit the wall on 8.16. Here are the books requirements:
(Date Class) Create class Date with the following capabilities:

Output the date in multiple formats, such as

MM/DD/YYYY
June 14, 1992
DDD YYYY

Use overloaded constructors to create Date objects initialized with dates of the formats in part (a). In the first case the constructor should receive three integer values. In the second case it should receive a String and two integer values. In the third case it should receive two integer values, the first of which represents the day number in the year. [Hint: To convert the string representation of the month to a numeric value, compare strings using the equals method. For example, if s1 and s2 are strings, the method call s1.equals( s2 ) returns true if the strings are identical and otherwise returns false.]

If anyone could help me with this code or has the code so I can take a look at it I would be extremely grateful. I want to stress that this is not homework and I am not asking for someone to help me cheat. Thanks in advance for any help, and if this is the wrong place to post let me know.
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

"HellKat",
Welcome to the JavaRanch.

We're a friendly group, but we do require members to have valid display names.

Display names must be two words: your first name, a space, then your last name. Fictitious names are not allowed.

Please edit your profile and correct your display name since accounts with invalid display names get deleted, often without warning

thanks,
Dave
Joanne Neal
Rancher

Joined: Aug 05, 2005
Posts: 3432
    
  12
The spec is pretty detailed, so can you tell us exactly which bit you are having trouble with. Post what code you have so far.


Joanne
Steve Morrow
Ranch Hand

Joined: May 22, 2003
Posts: 657

Already answered here:

http://forum.java.sun.com/thread.jspa?threadID=5185374
 
Consider Paul's rocket mass heater.
 
subject: Date CLass
 
Similar Threads
Check String for null without error?
== and equals
wrapper classes
Date CLass
WHEN ARE TWO STRINGS EQUAL?