Results 1 to 2 of 2
  1. #1
    infernocy is offline Member
    Join Date
    Apr 2012
    Rep Power

    Default custom made up date class with calendar


    Below is the Rentable class where i have some trouble with assigning some fields
    first i need three dates the default date , a return date , and the service date --
    in the code bellow vServiceDate in the constructor has that value - is it possible to create a new field and get that value from like what i did .
    The next is can i assign a calendar to show the default date
    basically i have trouble in how to compare the three fields i need

    thanks for all the help

    Java Code:
    public class RentableCar extends Car implements Rentable
       public Date defaultDate; 
       public Date returnDate;
       public Date newSdate;
         * Constructor for objects of class RentableCar
        public RentableCar(String vCode , String vHomeDepot , String vMake , Date vServiceDate , String newFuel ,
          int newEngineSize , int   Trans , Date newDefaultDate , Date newReturnDate   )
           super(vCode , vHomeDepot , vMake , vServiceDate ,  newFuel ,  newEngineSize ,  Trans);
            defaultDate = newDefaultDate;
            returnDate = newReturnDate;
            newSdate  = vServiceDate;
        public  boolean pickUp(Date d) {
        return true;
          public boolean isRented(){
        if(( returnDate != newSdate ) && (returnDate != defaultDate)) {
        return false;
         else {
          return true;
        public Date getReturnDate(){
        return defaultDate;
       public void dropOff(){
    Last edited by JosAH; 04-12-2012 at 07:03 PM. Reason: changed [quote] ... [/quote] tags to [code] ... [/code] tags

  2. #2
    KevinWorkman's Avatar
    KevinWorkman is offline Crazy Cat Lady
    Join Date
    Oct 2010
    Washington, DC
    Rep Power

    Default Re: custom made up date class with calendar

    When comparing Objects, don't use == or !=. Use the .equals() method instead. The == operator tests whether two Objects are the same instance. The .equals() method tests for semantic equality.
    How to Ask Questions the Smart Way
    Static Void Games - GameDev tutorials, free Java and JavaScript hosting!
    Static Void Games forum - Come say hello!

Similar Threads

  1. Help with date compare in calendar
    By aksis in forum New To Java
    Replies: 1
    Last Post: 12-01-2011, 09:48 PM
  2. Manually setting a date using Calendar and Date
    By ravl13 in forum New To Java
    Replies: 3
    Last Post: 10-26-2011, 12:12 AM
  3. Creating a Gregorian Calendar using a Date object gives date - 1
    By prachi_goliwadekar in forum New To Java
    Replies: 1
    Last Post: 05-08-2008, 09:32 PM
  4. java Date and Calendar
    By valoyivd in forum New To Java
    Replies: 1
    Last Post: 03-30-2008, 07:49 PM
  5. Calendar.DATE
    By mew in forum New To Java
    Replies: 1
    Last Post: 01-04-2008, 08:51 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts