I know the picture is blurred and missed some work on few lines, but can anyone
ID: 3816986 • Letter: I
Question
I know the picture is blurred and missed some work on few lines, but can anyone provide the code in Java based on the pseudo code?
I do rate the answer, so please answer as accurate as possible, Thanks!
Declare a vari of type Fitesystemintry named kid set kid equal to ent get child If kid is not equal to null If remainName s length is o OR NOT kid, isD Raise a File AL Recurse using kid as the FilesystemEntry, nName as the name ar End If Else LE remaintamo s tength is Declare a variable of type FilesystemEntry named newfile Set newFule equal to Use addChild() to add new File (curName, fitesizel as ent s child Else Declare a variable of type Filesystemen try named newoir Set nevoir equal to File createDirectorytcurNamel Use addChild() to add nehoir as ent child Recurse using newDir as the FilesysterEntry, remainName as the name, End IfExplanation / Answer
//Find below pseudo code in java
FileSystemEntry kid;
kid = ent.getChild(curName);
if(kid != null){
if(remainName.length() == 0 || kid.isDirectory()){
throw new FileAlreadyExistException();
}else{
//TBD
}
}else if(remainName.length() == 0){
FileSystemEntry newFile
newFile=FileSystemEntry.createFile(currName,fileSize);
addChile(ent);
}else{
FileSystemEntry newDir = null;
newDir = FileSystemEntry.createDirectory(currName);
addChild(ent);
//TBD
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.