Hi how's everyone doing, please help me with this program, i am doing this from last 4 to 5 hours, it's over my head, please help.
here's the what program suppose to do:
Given an input data file containing dates, one date per line, write a Java application Project.java which
will read lines of text from data file and put them into a partially-filled array of strings, and will then print
the contents of the array to a series of three JOptionPane message dialog boxes with text areas. The
first message box will display a column of the dates in the original order in which they were listed in the
file. The second message box will display a column of the dates sorted in lexicographical order, as
strings. The third message box will display a column of the dates in ascending order by date (earliest
date first).
import javax.swing.*;
public class pro1111
{
public static void main (String [] args)
{
TextFileInput in = new TextFileInput("Dates.txt");
TextFileOutput out = new TextFileOutput("Dates1.txt");
String line = in.readLine();
while ( line != null ) {
StringTokenizer st = new StringTokenizer(line, "/");
int monthNumber = Integer.parseInt(st.nextToken());
int day = Integer.parseInt(st.nextToken());
int year = Integer.parseInt(st.nextToken());
out.println(monthNumberToName(monthNumber)
+ " " + day + ", " + year);
line = in.readLine();
}
}
private static compareDate(string date1, string date2)
{
String date1 = "09/27/2004";
String date2 = "05/04/2002";
if (compareDate(date1, date2) < 0)
System.out.println("date1 is earlier than date2.");
return 0;
}
private static void display(short[] numbers,
int lengthFilled)
{
final String lineBreak = System.getProperty("line.separator");
// Create text area for output:
JTextArea textArea = new JTextArea();
textArea.setEditable(false);
// Print numbers to output text area:
for ( int i = 0; i < lengthFilled; i++ )
textArea.append(numbers[i] + lineBreak);
// Display the output text area via a message dialog box:
JOptionPane.showMessageDialog(null, textArea);
}