diff --git a/sp19-hw3-template/CarClient.java b/sp19-hw3-template/CarClient.java deleted file mode 100644 index d9d4869..0000000 --- a/sp19-hw3-template/CarClient.java +++ /dev/null @@ -1,56 +0,0 @@ -import java.util.Scanner; -import java.io.*; -import java.util.*; -public class CarClient { - public static void main (String[] args) { - String hostAddress; - int tcpPort; - int udpPort; - int clientId; - - if (args.length != 2) { - System.out.println("ERROR: Provide 2 arguments: commandFile, clientId"); - System.out.println("\t(1) : file with commands to the server"); - System.out.println("\t(2) client id: an integer between 1..9"); - System.exit(-1); - } - - String commandFile = args[0]; - clientId = Integer.parseInt(args[1]); - hostAddress = "localhost"; - tcpPort = 7000;// hardcoded -- must match the server's tcp port - udpPort = 8000;// hardcoded -- must match the server's udp port - - try { - Scanner sc = new Scanner(new FileReader(commandFile)); - - while(sc.hasNextLine()) { - String cmd = sc.nextLine(); - String[] tokens = cmd.split(" "); - - if (tokens[0].equals("setmode")) { - // TODO: set the mode of communication for sending commands to the server - } - else if (tokens[0].equals("rent")) { - // TODO: send appropriate command to the server and display the - // appropriate responses form the server - } else if (tokens[0].equals("return")) { - // TODO: send appropriate command to the server and display the - // appropriate responses form the server - } else if (tokens[0].equals("inventory")) { - // TODO: send appropriate command to the server and display the - // appropriate responses form the server - } else if (tokens[0].equals("list")) { - // TODO: send appropriate command to the server and display the - // appropriate responses form the server - } else if (tokens[0].equals("exit")) { - // TODO: send appropriate command to the server - } else { - System.out.println("ERROR: No such command"); - } - } - } catch (FileNotFoundException e) { - e.printStackTrace(); - } - } -} diff --git a/sp19-hw3-template/CarServer.java b/sp19-hw3-template/CarServer.java deleted file mode 100644 index ab6b449..0000000 --- a/sp19-hw3-template/CarServer.java +++ /dev/null @@ -1,17 +0,0 @@ -public class CarServer { - public static void main (String[] args) { - int tcpPort; - int udpPort; - if (args.length != 1) { - System.out.println("ERROR: Provide 1 argument: input file containing initial inventory"); - System.exit(-1); - } - String fileName = args[0]; - tcpPort = 7000; - udpPort = 8000; - - // parse the inventory file - - // TODO: handle request from clients - } -} diff --git a/sp19-hw3-template/cmdFile b/sp19-hw3-template/cmdFile deleted file mode 100644 index 70b72fa..0000000 --- a/sp19-hw3-template/cmdFile +++ /dev/null @@ -1,8 +0,0 @@ -setmode T -rent Mike "Ford" "Blue" -rent Jack "Lexus" "Black" -rent Lucy "Tesla" "Silver" -list Lucy -return 1 -inventory -exit diff --git a/sp19-hw3-template/input.txt b/sp19-hw3-template/input.txt deleted file mode 100644 index 463c649..0000000 --- a/sp19-hw3-template/input.txt +++ /dev/null @@ -1,4 +0,0 @@ -"Ford" "Blue" 6 -"Lexus" "Red" 3 -"Toyota" "Yellow" 10 -"Tesla" "Silver" 16 \ No newline at end of file diff --git a/sp19-hw3-template/inventory.txt b/sp19-hw3-template/inventory.txt deleted file mode 100644 index fab30e5..0000000 --- a/sp19-hw3-template/inventory.txt +++ /dev/null @@ -1,4 +0,0 @@ -"Ford" "Blue" 6 -"Lexus" "Red" 3 -"Toyota" "Yellow" 10 -"Tesla" "Silver" 16 diff --git a/sp19-hw3-template/out_1.txt b/sp19-hw3-template/out_1.txt deleted file mode 100644 index 591682d..0000000 --- a/sp19-hw3-template/out_1.txt +++ /dev/null @@ -1,9 +0,0 @@ -Your request has been approved, 1 Mike "Ford" "Blue" -Request Failed - We do not have this car -Your request has been approved, 2 Lucy "Tesla" "Silver" -2 "Tesla" "Silver" -1 is returned -"Ford" "Blue" 6 -"Lexus" "Red" 3 -"Toyota" "Yellow" 10 -"Tesla" "Silver" 15 \ No newline at end of file