NamePros
Welcome, Guest! Ready to make a name for yourself in the domain business? We welcome both the hobbyist and professional domainer to join the discussion as part of the NamePros community.

Click here to create your profile to start earning reputation for posting, and trader ratings for buying & selling in our free e-marketplace. Build your trader rating with each successful sale. Our system has tracked over 100,000 sales and counting!
FAQ & TOS Register Search Today's Posts Mark Forums Read

Go Back   NamePros.com > Website Development Discussion Forums > Programming
Reload this Page I need help with this JAVA programm

Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics.

Advanced Search


Closed Thread
 
LinkBack Thread Tools
Old 07-11-2006, 02:44 PM THREAD STARTER               #1 (permalink)
New Member
Join Date: Jul 2004
Posts: 6
maziar is on a distinguished road
 



Help! I need help with this JAVA programm


Write a program which will read two timestamps from a file and then create an output file that lists the timestamps in order (earliest first), and also displays how many days, hours and minutes are between them. Here are the requirements for the input and output formats:

The program user must enter the name of the input file.
The input file must have one timestamp on each line.
A timestamp consists of a date, followed by a space, followed by a time of day.
All dates will be in the form: month number, slash, date number, slash, year number. However, there are no restrictions on the number of digits for the months, dates or years. If a year only has 2 digits and is >= 20, assume the first two digits are 19. If a year is < 20, assume the first two digits are 20. For example, valid dates are: 7/4/06 (July 4, 2006), 12/25/50 (December 25, 1950), 2/28/1974 (February 28, 1974).
All times of day will be in the form: hours, followed by a colon, followed by minutes, followed by "am", "AM", "pm" or "PM". (We are not using military time for the input of this assignment, only for the output.) For example, valid times are: 3:30pm, 7:05am, 10:45AM.
????: NamePros.com http://www.namepros.com/programming/215929-i-need-help-with-java-programm.html
The output file must be called "timestamps.txt".
Each timestamp in the output file should have exactly two digits for all parts of the dates and the times, except for the year which must have 4 digits. Output the times in military format.
There should be one timestamp per line in the output file, the earlier one first.
The third line of output should state how many days, hours and minutes are between the two timestamps. These should all be non-negative values.
Implementation Details: YOU MAY NOT USE THE SCANNER CLASS FOR THIS ASSIGNMENT!! You must use BufferedReader and/or some form of tokenizers to handle the input. Don't forget that a leap year has 29 days in February. A leap year is one that is evenly divisible by 4, but not by 100 unless also by 400. For example 1500 is not a leap year, but 1600 is, as is 1976. HINT: for each date calculate the number of days since 1/1/0000. Name your program file pg2a.java. In order to test your program, you will need to make up several of your own input files to use.


help??? PLEASE!!!!
maziar is offline  
Old 07-11-2006, 03:00 PM   #2 (permalink)
NamePros Member
 
CreedFeed's Avatar
Join Date: Apr 2006
Posts: 186
CreedFeed is on a distinguished road
 



Sounds like homework lol...
CreedFeed is offline  
Old 07-11-2006, 07:23 PM THREAD STARTER               #3 (permalink)
New Member
Join Date: Jul 2004
Posts: 6
maziar is on a distinguished road
 



Originally Posted by CreedFeed
Sounds like homework lol...
it is...
maziar is offline  
Old 07-12-2006, 11:34 AM   #4 (permalink)
NamePros Regular
 
monaco's Avatar
Join Date: Jul 2005
Location: Tucson, AZ
Posts: 689
monaco will become famous soon enough
 



What's the point of asking someone else to do your homework for you? Do your own damn homework, lest you wind up as inept and incompetent at coding as our friends at microsoft

In all seriousness though, this is an easy problem to solve, it's just tedious with lots of exceptions.

In all fairness though, the last time I had to do something similar to this at work I just used java's Date and Calendar classes to parse the format and do the interval math for me...though I don't think this is the point of this particular assignment.
__________________
My Website | My Blog
monaco is offline  
Closed Thread


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools


Liquid Web Smart Servers  
All times are GMT -7. The time now is 08:48 AM.

Managed Web Hosting by Liquid Web
Domain name forum recommended by Domaining.com Powered by: vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.6.0 Ad Management plugin by RedTyger