Skip to content

Commit

Permalink
pretty print all appointment a user has (viewAppointments)
Browse files Browse the repository at this point in the history
  • Loading branch information
carl committed Jun 21, 2011
1 parent bcfc1d5 commit 25a327d
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions project/src/client/Client.java
Expand Up @@ -54,9 +54,9 @@ public static void main(String[] args) throws Exception
Boolean isPrivate;
AppointmentType type;
HashSet <String> userEmails = new HashSet <String>();
SimpleDateFormat dateFormater = new SimpleDateFormat("dd.MM.yy hh:mm");
while (true)
{
SimpleDateFormat dateFormater = new SimpleDateFormat("dd.MM.yy hh:mm");
System.out.println("Enter the starting date with format dd.MM.yy hh:mm");
String input = in.readLine();
Date inpTime;
Expand All @@ -76,7 +76,6 @@ public static void main(String[] args) throws Exception
}
while (true)
{
SimpleDateFormat dateFormater = new SimpleDateFormat("dd.MM.yy hh:mm");
System.out.println("Enter the ending date with format dd.MM.yy hh:mm");
String input = in.readLine();
Date inpTime;
Expand Down Expand Up @@ -182,7 +181,7 @@ public static void viewAppointments(Collection<Appointment> appointments)
System.out.println("No appointments");
return;
}
System.out.printf("start\tend\ttitle\tprivate\ttype\tnotes\n");
System.out.printf("start\t\tend\t\tprivate\tttype\ttype\tnotes\n");
for(Appointment a: appointments)
{
printAppointment(a);
Expand All @@ -191,7 +190,13 @@ public static void viewAppointments(Collection<Appointment> appointments)

public static void printAppointment(Appointment a)
{
SimpleDateFormat dateFormater = new SimpleDateFormat("dd.MM.yy hh:mm");
System.out.printf("%s\t%s\t%s\t%s\t%s\t%s\n",
a.start, a.end, a.title, a.isPrivate, a.type, a.notes);
dateFormater.format(a.start.getTime()),
dateFormater.format(a.end.getTime()),
a.isPrivate,
a.type,
a.title,
a.notes);
}
}

0 comments on commit 25a327d

Please sign in to comment.