HERe is the code for CMS.java. when i run this code using the main program from class that's in the package, it won't delete cms resources. it adds the resources with addresource() method. want you to recheck the delete() method of the resources and also want to load resources to the file using loadhumanresources() and display using the display human resources or within the method of loadhumanresources.
Q 10 IP 22122021222020212 EWorkspace - ClassAssign33/src/CMS.java - Eclipse IDE File Edit Source Refactor Navigate Search Project Run Window Help * 0 1 - 1 - Packa... x CMS.java X runner.java ClassAssign33 src (default package) CMS > ClassAssign33 10 import java.io.*; > Java Application1 2 import java.util.*; 3 > latest Project 4 public class CMS implements Serializable > week 1 5 String FILENAMEms; > Week 2 6 private File file; week 3 lab 3 3 7 private ArrayList
CMlist = new ArrayList(); > Week 4 8 ArrayList printlist = new ArrayList(); Week 5 9 ArrayList temp = new ArrayList(); 10 > Week 6 Scanner innne = new Scanner(System.in); 11 Week 7 120 public CMS() { > Week 8 13 CMlist = new ArrayList(); 14 FILENAMEms = "temfile.dat";// the name of the file for reservation file = new File(FILENAMEcms); 16 } 17 180 public CMS (String filename) { 19 CMlist = new ArrayList(); 20 FILENAMEms = filename; 21 file = new File(FILENAMEcms); 22 } 23 240 public void addcms Resource (String TYPE) { 25 26 // it adds to the list 27 if (tYPE.toLowerCase().matches ("teacher"))// associate to the teacher class using the interfaces 28 {// this method only adds the cms resources to the list and then asks in the main 29 // program to save the resources to file or not! 30 cmsteacher teac = new cmsteacher(); 31 CMlist.add(teac. ResourceUtilizer()); 32 } else if (tYPE.to LowerCase().matches ("student")) { Student student = new Student(); CMlist.add(student. ResourceUtilizer(); } } 15 33 34 35 36 37 PRA nublic void dalemeDecauca/ctrina idl thras TOFvcantion FileNotFoundEvrentinn N11 DaintarFvcantions Writable Smart Insert 282:2: 9396 Type here to search wa 5:25 PM 30-Dec-20 10 OP } EWorkspace - ClassAssign33/src/CMS.java - Eclipse IDE File Edit Source Refactor Navigate Search Project Run Window Help 11--* Packa... x CMS.java X runner.java ClassAssign33 src (default package) CMS savecmsResourcetothefile(): void > ClassAssign33 34 CMlist.add(student.ResourceUtilizer()); > Java Application1 35 } > latest Project 36 } >week 1 37 > Week 2 38 public void delcms Resource(String id) throws IOException, FileNotFoundException, NullPointerException { week 3 lab 3 39 for (int i = 0; i Week 4 40 if (CMlist.get(i).returnid().equals(id)) { >Week 5 41 System.out.println("true"); > Week 6 42 } >Week 7 43 >Week 8 44 } 45 460 public void delcmsre(String id) { 47 for (int i = 0; i ClassAssign33 63 e.printStackTrace(); > Java Application1 64 } > latest Project 65 } >week 1 66 > Week 2 67 public void printresources() throws Exception, FileNotFoundException, ClassNotFoundException { > week 3 lab 3 68 System.out.println("\t\t\t\t*Printing*"); >Week 4 69 for (int i = 0; i Week 5 70 System.out.println(CMlist.get(i).toString(); > Week 6 71 } >Week 7 72 } >Week 8 73 740 @Override A 75 public String toString() { 76 String s = ""; 77 for (int i = 0; i ClassAssign33 > Java Application1 > latest Project >week 1 > Week 2 week 3 lab 3 >Week 4 >Week 5 > Week 6 >Week 7 >Week 8 *CMS.java X runner.java ClassAssign33 src (default package) CMS Person 116 } 117 } 118 1190 public void loadfromtheFILEtothearraylist() { 1200 try (ObjectInputStream ssss = new ObjectInputStream(new FileInputStream(file)) { 121 // overriden such that the header might not be written again. 122 }) {// the cmlist will be useful for print the resources 123 for (int i = 0; i ClassAssign33 > Java Application1 > latest Project >week 1 > Week 2 week 3 lab 3 >Week 4 >Week 5 > Week 6 >Week 7 >Week 8 *CMS.java X Drunner.java ClassAssign33 src (default package) CMS cmsteacher 133 protected String type; 134 String transportationmetthod; 135 protected Scanner inp = new Scanner(System.in); 136 protected String name; 137 protected int age; 138 protected String idcard; 139 protected String phonenumber; 140 protected String address; 141 1420 Person() { 143 } 144 1450 public String returnid() { 146 return idcard; 147 } 148 1490 Person(String n, int a, String i, String P, String aadres, String transportationmetthod) { 150 name = n; 151 age = a; 152 idcard = i; 153 phonenumber = p; 154 address = aadres; 155 } 156 } 157 158 class cmsteacher extends Person implements Serializable// this adds the member of the faculty class and implements 159 // interface 160 { 161 String transportationmetod; 162 private String qualification; Writable Smart Insert 162:5: 4842 Type here to search 5:27 PM 30-Dec-20 E Workspace - ClassAssign33/src/CMS.java - Eclipse IDE File Edit Source Refactor Navigate Search Project Run Window Help UT Packa... x 10 OP > ClassAssign33 > Java Application1 > latest Project >week 1 > Week 2 > week 3 lab 3 >Week 4 >Week 5 > Week 6 >Week 7 >Week 8 *CMS.java X runner.java ClassAssign33 src# (default package) CMS cmsteacher ResourceUtilizer(): cmsteacher 159 // interface 160 { 161 String transportationmetod; 162 private String qualification; 163 1640 public cmsteacher(String name, String address, String phonenumber, String idcard, int age, String qualificatic 165 String transportationmetod) { 166 this.name = name; 167 this.address = address; 168 this.phonenumber = phonenumber; 169 this.idcard = idcard; 170 this.age = age; 171 this.qualification = qualification; 172 this.transportationmetod = transportationmetod; 173 type = "teacher"; 174 } 175 1760 public cmsteacher() { 177 type = "teacher"; 178 } 179 1890 public cmsteacher ResourceUtilizer() { 181 System.out.println("enter address"); 182 address = inp.nextLine(); 183 System.out.println("enter age"); 184 age = inp.nextInt(); 185 System.out.println("are you getting transportation? write y for yes and n for false"); 186 char ch = inp.next().charAt(0); 187 transportation ytyt = new transportation();// not to make an instance in an if condition 188 if (ch == 'y') Writable Smart Insert 188: 5: 5731 O Type here to search 5:27 PM 30-Dec-20