From c28eadaa2bc13708d82fbc1b6d60a686dae75026 Mon Sep 17 00:00:00 2001 From: Mostafawww <47588007+Mostafawww@users.noreply.github.com> Date: Fri, 20 Mar 2020 10:07:25 +0200 Subject: [PATCH 1/3] Create mm --- mm | 1 + 1 file changed, 1 insertion(+) create mode 100644 mm diff --git a/mm b/mm new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/mm @@ -0,0 +1 @@ + From 0fbf346512de237fb578264fce79e1a95a63d606 Mon Sep 17 00:00:00 2001 From: Mostafawww <47588007+Mostafawww@users.noreply.github.com> Date: Fri, 20 Mar 2020 10:30:30 +0200 Subject: [PATCH 2/3] Add files via upload --- Student.md.txt | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 Student.md.txt diff --git a/Student.md.txt b/Student.md.txt new file mode 100644 index 0000000..2c43f2c --- /dev/null +++ b/Student.md.txt @@ -0,0 +1,4 @@ + +Name/ mostafa arafat amin arafat al-ashker + +Section/ 6 From a180a5db2914102d59ed406256678efe25ffc179 Mon Sep 17 00:00:00 2001 From: Mostafawww <47588007+Mostafawww@users.noreply.github.com> Date: Fri, 20 Mar 2020 10:36:18 +0200 Subject: [PATCH 3/3] Update CustomerManagerApp.java --- Project/OSTask1/src/CustomerManagerApp.java | 45 +++++++++++---------- 1 file changed, 24 insertions(+), 21 deletions(-) diff --git a/Project/OSTask1/src/CustomerManagerApp.java b/Project/OSTask1/src/CustomerManagerApp.java index 2a27245..9b42b9c 100644 --- a/Project/OSTask1/src/CustomerManagerApp.java +++ b/Project/OSTask1/src/CustomerManagerApp.java @@ -1,37 +1,40 @@ -import java.util.List; +import java.util.Scanner; public class CustomerManagerApp { - // declare class variables - private static DAO customerDAO = null; public static void main(String[] args) { // display a welcome message System.out.println("Welcome to the Customer Manager\n"); - // set the class variables - customerDAO = new CustomerTextFile(); + int action; + Scanner scanner=new Scanner(System.in); + System.out.println("1 for list , 2 for add , 3 for delet , 4 for help , 5 for exit "); + System.out.print("Enter a command : "); + action=scanner.nextInt(); + + while (action!=5) { + - // display the command menu - displayMenu(); - - // perform 1 or more actions - String action = ""; - while (!action.equalsIgnoreCase("exit")) { - // get the input from the user - action = Console.getString("Enter a command: "); - System.out.println(); - - if (action.equalsIgnoreCase("list")) { + if (action==1) { displayAllCustomers(); - } else if (action.equalsIgnoreCase("add")) { + System.out.print("Enter a command : "); + action=scanner.nextInt(); + } else if (action==2) { addCustomer(); - } else if (action.equalsIgnoreCase("del") || action.equalsIgnoreCase("delete")) { + System.out.print("Enter a command : "); + action=scanner.nextInt(); + } else if (action==3) { deleteCustomer(); - } else if (action.equalsIgnoreCase("help") || action.equalsIgnoreCase("menu")) { + System.out.print("Enter a command : "); + action=scanner.nextInt(); + } else if (action==4) { displayMenu(); - } else if (action.equalsIgnoreCase("exit")) { + System.out.print("Enter a command : "); + action=scanner.nextInt(); + } else if (action==5) { System.out.println("Bye.\n"); + break; } else { System.out.println("Error! Not a valid command.\n"); } @@ -93,4 +96,4 @@ public static void deleteCustomer() { System.out.println("No customer matches that email.\n"); } } -} \ No newline at end of file +}