File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes Quick question about the date class Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Quick question about the date class" Watch "Quick question about the date class" New topic
Author

Quick question about the date class

Jim Stevens
Greenhorn

Joined: Jun 08, 2011
Posts: 28
So i was told to create a credit card class and include the date class in it. I have a tester program to check through my created class. The only test i have failing is test 11. It says that getDateAccountOpened changes date that account was opened. Not to sure about what is going on. A little guidence would be awesome. i will attach the program and test program.

This is my credit card class



Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14195
    
  20

Jim evnas wrote:It says that getDateAccountOpened changes date that account was opened.

Look at the code. Can you explain what it is doing?


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 8 API documentation
Jim Stevens
Greenhorn

Joined: Jun 08, 2011
Posts: 28
The Date date = new Date(); I assume this imports the use of the Date class. The return date only returns the date to the main program. I honestly am not to sure...
Philip Grove
Ranch Hand

Joined: Aug 18, 2009
Posts: 68

You need to look into what happens when you get to the line


Hint: It's very clear when you look at the documentation.

You probably need to look into the Calendar class (it's abstract) unless you want to save date as milliseconds since the epoch. While it does have it advantages in many situations absolute dates might be easier to understand than relative values.
Jim Stevens
Greenhorn

Joined: Jun 08, 2011
Posts: 28
Ok
 
GeeCON Prague 2014
 
subject: Quick question about the date class