• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Help with maze time result code...

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey guys,

Just asking for a little help here. I am trying to finish a java program for a class and I am stuck on a bit of code. I've figured out most of the code but am stuck on the code at the end:




Here is the code in it's entirety:

 
Sheriff
Posts: 11343
Mac Safari Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Phillip Browne:
...I've figured out most of the code...


Welcome to JavaRanch!

Have you compiled this code yet? Don't wait until it's "done" to compile. You should recompile each time you add something, so you don't end up with errors that build on each other.

Also, if "Time" is java.sql.Time, you should check the API. Most of the methods are deprecated. The non-deprecated methods are inherited from java.util.Date, so you might want to consider using Date instead. Better yet, use java.util.Calendar.
[ March 08, 2008: Message edited by: marc weber ]
 
Marshal
Posts: 79964
396
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Agree with Marc Weber. Also your method which has a return null in looks very peculiar; I think it might not work correctly. Beware of returning null anywhere; it can produce unexpected exceptions or errors later.
 
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well you have these members in the maze result:

private Rat rodent;
private Time startTime;
private Time endTime;

Perhaps your toString() would do something like:

return getRodent().toString() + "; start: " + getStartTime() + "; end: " + getEndTime();

Rat class should have a toString method too.
 
You didn't tell me he was so big. Unlike this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic