Starting from:

$40+

CSC 207 Assignment 2A and 2B

CSC 207 Assignment 2A

Introduction:
In Assignment1, you and your partner used CRC cards to design a set of classes for
maintaining a mock file system and interacting with it in a program that operates
like a Unix shell. You also did some minimal programming in order to get used to
sharing code using an SVN repository.
In Assignment2, you will be working in a team of 4. The design requirements for
Assignment2A are quite similar to those of Assignment1, although we have modified
the commands a bit. There will be two parts to Assignment2. This is Assignment2A
or the first part of Assignment2. Read this document carefully.
Commands:
In all of the following commands, there may be any amount of whitespace (1 or
more spaces and tabs) between the parts of a command.
For example (all the four variations are correct and considered valid):
/#: mv someFile1 someFile2
/#: mv someFile1 someFile2
/#: mv someFile1 someFil
/#: mv someFile1 someFile2
Note: Furthermore, your program must not crash. Square brackets indicate an
optional argument. Some commands may have… which indicates a list of
arguments. And every PATH, FILE, and DIR may either be a relative path or a full
path (absolute path).
exit
Quit the program.
mkdir DIR …
Create directories, each of which may be relative to the current
directory or may be a full path.
cd DIR
Change directory to DIR, which may be relative to the current directory or
may be a full path. As with Unix, .. means a parent directory and a . means
the current directory. The directory separator must be /, the forward slash.
The root of the file system is a single slash: / .
ls [PATH … ]
If no paths are given, print the contents (file or directory) of the current
directory, with a new line following each of the content (file or directory).
Otherwise, for each path p, the order listed:
• If p specifies a file, print p (i.e. the name of the file only)
• If p specifies a directory, print p, a colon, then the contents of
that directory, then an extra new line.
• If p does not exist, print a suitable error message.
pwd
Print the current working directory path (i.e. the whole absolute path)
pushd DIR
Saves the current working directory by pushing onto the directory stack and
then changes the new current working directory to DIR. The push must be
consistent as per the LIFO behavior of a stack. The pushd command saves the
old current working directory in directory of stack so that it can be returned to
at any time (via the popd command). The size of the directory stack is dynamic
and dependent on the pushd and popd commands.
popd
Remove the top entry from the directory stack, and cd into it. The removal
must be consistent as per the LIFO behavior of a stack. The popd command
removes the top most directory from the directory stack and makes it to the
current working directory. If there is no directory onto the stack, then give
appropriate error message.
history [number]
This command will print out recent commands, one command per line. i.e.
1 cd ..
2 mkdir textFolder
3 echo “Hello World”
4 fsjhdfks
5 history
The above output from history has two columns. The first column is numbered
such that the line with the highest number is the most recent command. The
most recent command is history. The second column contains the actual
command. Note: Your output should also contain as output any syntactical
errors typed by the user as seen on line 4.
We can truncate the output by specifying a number (=0) after the command.
For instance, if we want to only see the last 3 commands typed, we can type
the following on the command line:
history 3
And the output will be as follows:
4 fsjhdfks
5 history
6 history 3
cat FILE
Display the contents of FILE in the shell.
echo STRING [ OUTFILE]
If OUTFILE is not provided, print STRING on the shell. Otherwise, put STRING
into file OUTFILE. STRING is a string of characters surrounded by double
quotation marks. This creates a new file if OUTFILE does not exists and
erases the old contents if OUTFILE already exists. In either case, the only
thing in OUTFILE should be STRING.
echo STRING OUTFILE
Like the previous command, but appends instead of overwrites.
man CMD
Print documentation for CMD
============================================================
Task0 (MUST BE COMPLETED BY EACH TEAM MEMBER individually): DUE ON
17TH October @ 11:59PM
1) Check whether your UTORID Username and password works correctly on the
SVN repository.
2) Complete the honor code in JShell.java and commit it back to your SVN repo.
3) Read the readMe files that I have provided in each folder of your SVN repo to
understand what is expected of you.
Failure to complete Task0 by due date will result in that team member losing one
letter grade of his/her Assignment2A grade.
Task1:
Argue with your team until you have worked out a new design. Update your CRC
cards and commit them or explain why no changes were necessary. Use the same
format as last time (i.e. in Assignment1).
Task2:
Write the shell program implementing each of the above mentioned commands
follow the SCRUM software development process. Make sure that, by the deadline of
Assignment2A, the code you commit has been tested and fully documented.
Remember that you should try to check in code that can be compiled and executed
into your SVN repository.
In order to do well for this Assignment, you MUST strictly adhere to the SCRUM
software development process. Follow the instructions carefully that are mentioned
in the grading scheme and what I talked about in lecture regarding Assignment2.
On October 29th and October 30th, you will demo your Assignment2A to TA. More
details on this later.



CSC 207 Assignment 2B

Introduction:
In Assignment2B, you will continue to work on the mock file system and JShell. We
have modified the commands a bit, hence read this document very carefully. Note
that at end of Assignment2B, all commands and functionality that were mentioned
in Assignment2A and now mentioned in Assignment2B must be completed. If you
had any left over work from Assignment2A, your team must ensure that it is
completed in Assignment2B. If you create any new Exception classes, make sure to
update your CRC Cards accordingly with CRC Cards. You MUST also use Generics.
You will create a new productBacklog as productBacklog2.txt inside your
productBacklog folder. As in Assignment2A, you will continue to follow the scrum
software development process in 2B as well. At the end of Assignment2B, each one
of you will be asked to evaluate your team members. More details on this later.
You may want to first read the Assignment2B QandA on blackboard before getting
started with the assignment.
Commands:
In all of the following commands, there may be any amount of whitespace (1 or
more spaces and tabs) between the parts of a command.
For example (all the three variations are correct and valid):
/#: mv someFile1 someFile2
/#: mv someFile1 someFile2
/#: mv someFile1 someFile2
Furthermore, your program must not crash. Square brackets indicate an optional
argument.
Clarification: … indicates a list.
Clarification: every PATH, FILE, and DIR may either be relative path or a full path
(absolute path).
Addition: redirection, either with OUTFILE or OUTFILE, can be applied to every
command except for exit. This captures the output of the command and redirects it
to OUTFILE and no output is shown to the user. MAKE SURE THAT YOU NOT
REDIRECT ANY ERRORS. ALL ERROS MUST STILL BE DISPLAYED ON THE
CONSOLE. YOU ONLY REDIRECT STDOUTPUT AND NOT STDERROR. IF YOU ARE
NOT FAMILIAR WITH STDOUTPUT AND STDERROR, PLEASE REFER TO YOUR
LABS. If a command does not give any output (such as the cp command) then you
must not create OUTFILE.
exit
Quit the program
mkdir DIR …
Create directories, each of which may be relative to the current directory or
may be a full path.
cd DIR
Change directory to DIR, which may be relative to the current directory or
may be a full path. As with Unix, .. means a parent directory and a . means
the current directory. The directory must be /, the forward slash. The foot of
the file system is a single slash: /.
ls [-R] [PATH …]
Addition: if –R is present, recursively list all subdirectories.
If no paths are given, print the contents (file or directory) of the current
directory, with a new line following each of the content (file or directory).
Otherwise, for each path p, the order listed:
• If p specifies a file, print p
• If p specifies a directory, print p, a colon, then the contents of that
directory, then an extra new line.
• If p does not exist, print a suitable message.
pwd
Print the current working directory (including the whole path).
mv OLDPATH NEWPATH
Addition: This is a new command in Assignment2B
Move item OLDPATH to NEWPATH. Both OLDPATH and NEWPATH may be
relative to the current directory or may be full paths. If NEWPATH is a
directory, move the item into the directory.
cp OLDPATH NEWPATH
Addition: This is a new command in Assignment2B
Like mv, but don’t remove OLDPATH. If OLDPATH is a directory, recursively
copy the contents.
cat FILE …
Addition: if there are more than one file, you must display all their contents
on the console. (assuming all are valid path). For any file that contains invalid
path, just display an appropriate error for that path only. All other valid path
must still be shown on the console.
Display the contents of FILE and other files on the console in the shell.
get URL
Addition: This is a new command in Assignment2B
URL is a web address. Retrieve the file at that URL and add it to the current
working directory.
Example1:
get http://www.cs.cmu.edu/~spok/grimmtmp/073.txt
Will get the contents of the file i.e. 073.txt and create a file called
073.txt with the contents in the current working directory.
Example2:
get http://www.ub.edu/gilcub/SIMPLE/simple.html
Will get the contents of the file i.e. simple.html (raw html) and
create a file called simple.html with the contents in the current
working directory.
echo String
Print String
man CMD
Print documentation for CMD.
pushd DIR
Saves the current working directory by pushing onto directory stack and then
changes the new current working directory to DIR. The push must be
consistent as per the LIFO behavior of a stack. The pushd command saves
the old current working directory in directory stack so that it can be returned
to at any time (via the popd command). The size of the directory stack is
dynamic and dependent on the pushd and the popd commands.
popd
Remove the top entry from the directory stack, and cd into it. The removal
must be consistent as per the LIFO behavior of a stack. The popd command
removes the top most directory from the directory stack and makes it the
current working directory. If there is no directory onto the stack, then give
appropriate error message.
history [number]
This command will print out recent commands, one command per line. i.e.
1 cd ..
2 mkdir textFolder
3 echo “Hello World”
4 fsjhdfks
5 history
The above output from history has two columns. The first column is numbered
such that the line with the highest number is the most recent command. The
most recent command is history. The second column contains the actual
command. Note: Your output should also contain as output any syntactical
errors typed by the user as seen on line 4.
We can truncate the output by specifying a number (=0) after the command.
For instance, if we want to only see the last 3 commands typed, we can type the
following on the command line:
history 3
And the output will be as follows:
4 fsjhdfks
5 history
6 history 3
!number
Addition: This is a new command in Assignment2B
This command will recall any of previous history by its number(=1)
preceded by an exclamation point (!). For instance, if your history looks like
above, you could type the following on the command line of your JShell i.e.
!3
This will immediately recall and execute the command associated with the
history number 3. The above command of !3 will indirectly execute echo
“Hello World”.
grep [-R] REGEX PATH …
Addition: This is a new command in Assignment2B
If –R is not supplied, print any lines containing REGEX in PATH, which must
be a file. If –R is supplied, and PATH is a directory, recursively traverse the
directory and, for all lines in all files that contain REGEX, print the path to the
file (including the filename), then a colon, then the line that contained REGEX.
In order to do well for this Assignment, you MUST strictly
adhere to the SCRUM software development process just
as Assignment2A. Follow the instructions carefully that
are mentioned in the grading scheme (same grading
scheme applies for Assignment2B and Assignment2A).

More products