Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/.metadata/
12 changes: 12 additions & 0 deletions RemoteSystemsTempFiles/.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>RemoteSystemsTempFiles</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
</buildSpec>
<natures>
<nature>org.eclipse.rse.ui.remoteSystemsTempNature</nature>
</natures>
</projectDescription>
Binary file added To Do List.dat
Binary file not shown.
2 changes: 2 additions & 0 deletions bin/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/ToDoList$todo.class
/Appointments$appointment.class
Binary file modified bin/Appointments.class
Binary file not shown.
Binary file modified bin/PersonalInfo.class
Binary file not shown.
154 changes: 154 additions & 0 deletions src/Appointments.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,158 @@
import java.util.*;
import java.io.*;
import java.text.*;

public class Appointments {
static Vector<appointment> v = new Vector<appointment>();

static class appointment implements Serializable {

private String createdate;
private String where;
private String with_who;

private appointment(String createdate, String where, String with_who) {
this.createdate = createdate;
this.where = where;
this.with_who = with_who;
}

public String getCreatedate() {
return createdate;
}

public void setCreatedate(String createdate) {
this.createdate = createdate;
}

public String getWhere() {
return where;
}

public void setWhere(String where) {
this.where = where;
}

public String getWithWho() {
return with_who;
}

public void setWithWho(String with_who) {
this.with_who = with_who;
}
}

private static void saveFile() throws Exception {
ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream("Appointment List.dat"));
oos.writeObject(v);
oos.close();
}

public static void appointmentMenu() throws Exception {

File f = new File("Appointment List.dat");
if (!f.exists()) { // ���� ������
f.createNewFile();
} else { // ���� ������
ObjectInputStream ois = new ObjectInputStream(new FileInputStream(f));
v = (Vector<appointment>)ois.readObject();
ois.close();
}

PersonalInfo pInfo = new PersonalInfo();
System.out.println("\n<Appointment Menu>");
pInfo.printDetailMenu();

Scanner scan = new Scanner(System.in);

int n = scan.nextInt();

while (n != 5) {
if (n == 1) createAppointment();
else if (n == 2) viewAppointment();
else if (n == 3) updateAppointment();
else if (n == 4) deleteAppointment();
else if (n == 5) {
break;
}
saveFile();
System.out.println("\n<Appointment Menu>");
pInfo.printDetailMenu();
n = scan.nextInt();
}
}


public static void createAppointment() throws Exception{
Scanner scan = new Scanner(System.in);
System.out.print("Enter the date(YYMMDD): ");
String createdate = scan.next();

System.out.print("Enter the address: ");
String where = scan.next();

System.out.print("Enter the person: ");
String with_who = scan.next();

v.add(new appointment(createdate, where, with_who));

}

public static void viewAppointment() throws Exception{

System.out.println(" ");
for (int i = 0; i < v.size(); i++) {
System.out.println("---------- " + (i + 1) + " ----------");
System.out.println("Create Date: " + v.get(i).createdate);
System.out.println("Address: " + v.get(i).where);
System.out.println("Person: " + v.get(i).with_who);
System.out.println("------------------------");
}
}


public static void updateAppointment() throws Exception{
viewAppointment();
System.out.print("\nEnter To Do List Number you want to update: ");
Scanner scan = new Scanner(System.in);
int n = scan.nextInt();

System.out.print("Enter updated date(YYMMDD): ");
String createdate = scan.next();

System.out.print("Enter updated Address: ");
String where = scan.next();

System.out.print("Enter updated Person: ");
String with_who = scan.next();

v.get(n).createdate = createdate;
v.get(n).where = where;
v.get(n).with_who = with_who;

System.out.println("Complete!");


}
public static void deleteAppointment() throws Exception{
if (v.isEmpty()) viewAppointment();
else {
viewAppointment();
System.out.print("\nEnter Appointment Number you want to delete: ");
Scanner scan = new Scanner(System.in);
int n = scan.nextInt();

System.out.print("Want to delete " + n + "? (y/n): ");
String ch = scan.next();

if (ch.equals("y")) {
v.remove(n - 1);
System.out.println("Complete!");
} else {
System.out.println("Not deleted!");
}
}
}


}
3 changes: 2 additions & 1 deletion src/PersonalInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ public static void main(String[] args) throws Exception{

// Ŭ���� ��ü ����
ToDoList todo = new ToDoList();
Appointments appoint = new Appointments();

System.out.println("Hello!");
printMainMenu();
Expand All @@ -26,7 +27,7 @@ public static void main(String[] args) throws Exception{
while (n != 5) {
if (n == 1) ;
else if (n == 2) todo.toDoListMenu();
else if (n == 3) ;
else if (n == 3) appoint.appointmentMenu();
else if (n == 4) ;
printMainMenu();
}
Expand Down