首页 > > 详细

KIT501留学生讲解、讲解UNIX Scripting、C++程序语言调试、c/c++辅导解析R语言编程|讲解Java程序

KIT501 UNIX Scripting Assignment
Due Date: 3:00pm Friday the 9th of October - Week 12
Introduction
There are two (2) shell programming tasks in this assignment. This is an individual assignment. You
are required to make a directory named kit501a2 under your home directory (on ictteach)
and use kit501a2 as your working directory for this assignment.
Assignment submissions will be marked by the KIT501 tutors on ictteach (also known as
alacritas). If you write and test your scripts elsewhere it's your responsibility to ensure that your
scripts run correctly on the School UNIX system (ictteach). You must also submit your assignment
via this server (see later).
Please pay close attention to the marking scheme shown on the last page. This scheme shows you
how marks are allocated, and what you must (successfully) achieve to receive marks. Note also that
your scripts must have clear and tidy structure, have good use of indentation and whitespace (to
make the script readable), include appropriate comments, and have your identification details and
the script's purpose specified in comments at the top of your script.
Task A
Write a shell script (to run on the Bourne shell) called cp2.sh to copy all the files from two named
directories into a new third directory. Time stamps must be preserved while copying files from one
directory into another.
For example:
cp2.sh dir1 dir2 dir3
This example will copy all of the files in dir1 and dir2 to dir3.
Ø Note: dir1, dir2 and dir3 are example directory names. Your script should
not check for these example values explicitly. Instead, your script should allow any
directory names to be entered by the user, and then it uses those values entered
for any further commands that refer to the directories.
Continued on next page…
KIT501 ICT Systems Administration Fundamentals Unix Scripting Assignment
2
Task Requirements
1. Three directory names must be supplied as arguments to your script when it is executed by
the user.
2. In the beginning of your script you need to check that the first two directory names provided
(e.g. dir1 and dir2) exist under the current directory. If they do not exist, your script must
display an error message and then it should exit.
3. The third directory argument to the script will specify a new directory name (for example,
dir3). This directory must not currently exist (i.e. the creation of e.g. dir3 should be one
of the actions of your script). If the directory already exists, your script should display an
error message and exit.
4. The script will first copy all of the files from dir1 into dir3. Your script output must
indicate which files have been copied.
5. The script will then copy every file from dir2 to dir3 subject to the following conditions:
a. only copy if the file from dir2 is not already present in dir3; or
b. only copy if the file from dir2 is newer than the same file in dir3. The newer file
will overwrite the existing version in dir3.
Your script output must indicate which files have been copied.
6. Clean up - remove all temporary files created (if any) at the end of your script.
7. Your script must generate output similar to the example output shown below.
Ø HINT: You should note that the cp command without any option does not
preserve certain attributes (such as ownership and timestamps)
Example output
The following is a sample output of the script. The $ is the shell prompt.
$ ./cp2.sh dir1 dir2 dir3
These files from dir1 copied into dir3:
a.c b.c file1.c
These new file(s) from dir2 copied into dir3:
file2.c
These file(s) from dir2 copied into dir3 and overwrite(s) existing older
versions in dir3:
a.c
KIT501 ICT Systems Administration Fundamentals Unix Scripting Assignment
3
The following sample outputs verify the result shown previously so you can see the example file
names and timestamps used.
$ ls
cp2.sh dir1 dir2 dir3
$ ls -l dir1
total 12
-rw-r--r-- 1 sxu staff 9 Aug 2 12:52 a.c
-rw-r--r-- 1 sxu staff 9 Aug 2 12:52 b.c
-rw-r--r-- 1 sxu staff 9 Aug 2 12:52 file1.c
$ ls -l dir2
total 12
-rw-r--r-- 1 sxu staff 9 Aug 2 12:53 a.c
-rw-r--r-- 1 sxu staff 9 Aug 2 12:51 b.c
-rw-r--r-- 1 sxu staff 9 Aug 2 12:53 file2.c
$ ls -l dir3
total 16
-rw-r--r-- 1 sxu staff 9 Aug 2 12:53 a.c
-rw-r--r-- 1 sxu staff 9 Aug 2 12:52 b.c
-rw-r--r-- 1 sxu staff 9 Aug 2 12:52 file1.c
-rw-r--r-- 1 sxu staff 9 Aug 2 12:53 file2.c
Task B
Dominion Consulting in Sydney needs a shell script (to run on the Bourne shell) to maintain its
employee records file, which contains the following information (fields) about each employee:
• telephone number (8 digits, first digit non-zero);
• family name (alphabetic characters);
• first name (alphabetic characters);
• department number (2 digits) and
• job title (alphabetic characters).
This script should let users add, delete, search for, and display specific employee information.
Continued on next page…
KIT501 ICT Systems Administration Fundamentals Unix Scripting Assignment
4
Task Requirements
1. Create a text file named records containing the following records with fields delimited by
colons (:) :
95671660:Jones:Sarah:45:sales manager
93272658:Smith:John:43:technical manager
98781987:Williams:Nick:35:computer officer
99893878:Brown:Sarah:12:electrician
95673456:Couch:David:26:chef
95437869:Anderson:Sarah:19:CEO
2. In the beginning of your script you need to check to see whether the required text file
(records) actually exists under the current directory. If records does not exist, your
script must display an error message and then exit.
3. The script must be named menu.sh. The script must show a menu of operations (see
requirement 4) that a user may choose from. Among other tasks, these operations automate
the following four activities:
1) Display all current employee records to the screen;
2) Search for and display specific employee record(s) (search all fields, ignoring case);
3) Add new records to the records file; and
4) Delete records from the records file.
4. The script must show the following menu and prompt the user to select an option:
Dominion Consulting Employees Info Main Menu
============================================
1 – Print All Current Records
2 - Search for Specific Record(s)
3 - Add New Records
4 – Delete Records
Q - Quit
5. After a user chooses an option and the selected operation has been completed, the user is
prompted to press the Enter key, and then the menu must be displayed again so that the
user can make another selection.
Continued on next page…
KIT501 ICT Systems Administration Fundamentals Unix Scripting Assignment
5
6. When adding a new employee record (option 3), the script must ask the user to provide the
following field values (in order):
phone number
family name
given name
department number
job title
Each field must be correctly validated before the next field is requested. If validation fails,
the user must be asked to enter the field again (and this process repeats until the field is
successfully validated). After each successful employee record is added, the user should be
prompted to ask if they want to enter another employee record (this process will continue
until the user indicates they do not want to add another employee record).
Validation is as follows:
• family name: must be alphabetic characters and/or spaces.
• given name: must be alphabetic characters and/or spaces.
• job title: must be alphabetic characters and/or spaces.
• phone number: the first digit of an eight-digit phone number must not be zero.
Each telephone number must be unique (not already exist).
• department number: A valid department number must only contain 2 digits.
7. When deleting records (option 4), the user must be prompted to enter a valid phone
number. If the phone number is invalid, then the user will continue to be prompted until
they enter a valid phone number. If a record matches the phone number entered (hint: as
phone numbers are unique, only one record should match), then the matching record must
be displayed, and the user must be prompted to confirm they want to delete the matching
record.
Example output
Here is a sample output of the script which will indicate the main semantics of each option.
The $ is the shell prompt. The items in italics are not part of the sample output. They are
hints indicating how your script should behave. Items in green are examples of user input.
$ ./menu.sh
Dominion Consulting Employees Info Main Menu
============================================
1 – Print All Current Records
2 - Search for Specific Record(s)
3 - Add New Records
4 – Delete Records
Q - Quit
KIT501 ICT Systems Administration Fundamentals Unix Scripting Assignment
6
Your Selection: 1(user input)
95671660:Jones:Sarah:45:sales manager
93272658:Smith:John:43:technical manager
98781987:Williams:Nick:35:computer officer
99893878:Brown:Sarah:12:electrician
95673456:Couch:David:26:chef
95437869:Anderson:Sarah:19:CEO
Press Enter to continue... (user presses Enter here)
Dominion Consulting Employees Info Main Menu
============================================
1 – Print All Current Records
2 - Search for Specific Record(s)
3 - Add New Records
4 – Delete Records
Q - Quit
Your Selection: 5(user input)
Invalid selection
Press Enter to continue... (user presses Enter here)
Dominion Consulting Employees Info Main Menu
============================================
1 – Print All Current Records
2 - Search for Specific Record(s)
3 - Add New Records
4 – Delete Records
Q – Quit
Your Selection: 2(user input)
Enter keyword: Sarah (user input)
95671660:Jones:Sarah:45:sales manager
99893878:Brown:Sarah:12:electrician
95437869:Anderson:Sarah:19:CEO
Press Enter to continue... (user presses Enter here)
KIT501 ICT Systems Administration Fundamentals Unix Scripting Assignment
7
Continued on next page…
Dominion Consulting Employees Info Main Menu
============================================
1 – Print All Current Records
2 - Search for Specific Record(s)
3 - Add New Records
4 – Delete Records
Q - Quit
Your Selection: 2 (user input)
Enter keyword: Monks (user input)
Monks not found
Press Enter to continue... (user presses Enter here)
Dominion Consulting Employees Info Main Menu
============================================
1 – Print All Current Records
2 - Search for Specific Record(s)
3 - Add New Records
4 – Delete Records
Q – Quit
Your Selection: 2(user input)
Enter keyword: (user simply presses Enter without typing in anything)
Keyword not entered
Press Enter to continue... (user presses Enter here)
Dominion Consulting Employees Info Main Menu
============================================
1 – Print All Current Records
2 - Search for Specific Record(s)
3 - Add New Records
4 – Delete Records
Q – Quit
Your Selection: 3(user input)
Add New Employee Record
Phone Number (xxxxxxxx): (user simply presses Enter without typing in anything)
Phone number not entered
Phone Number (xxxxxxxx): 00123456 (user input)
Invalid phone number
Phone Number (xxxxxxxx): 95437869 (user input)
Phone number exists
Phone Number (xxxxxxxx): 99887766 (user input)
Continued on next page…
KIT501 ICT Systems Administration Fundamentals Unix Scripting Assignment
8
Family Name: abc123 (user input)
Family name can contain only alphabetic characters and spaces
Family Name: Warren (user input)
Given Name: Tony5 (user input)
Given name can contain only alphabetic characters and spaces
Given Name: Tony (user input)
Department Number: 123 (user input)
A valid department number contains 2 digits
Department Number: 23 (user input)
Job Title: accountant1 (user input)
Job title can contain only alphabetic characters and spaces
Job Title: accountant (user input)
Adding new employee record to the records file …
New record saved (display this only after saving record is successful)
Add another? (y)es or (n)o: n (user input – note: allow for y,Y, n,N)
(Note: if the user answer is y or Y here then the above procedure is repeated to allow another employee record to
be added)
Dominion Consulting Employees Info Main Menu
============================================
1 – Print All Current Records
2 - Search for Specific Record(s)
3 - Add New Records
4 – Delete Records
Q – Quit
Your Selection: 4(user input)
Delete Employee Record
Enter a phone number: 05671660 (user input)
Invalid phone number
Enter a phone number: 99999999 (user input)
Phone number not found
Enter a phone number: 95671660 (user input)
95671660:Jones:Sarah:45:sales manager
Confirm deletion: (y)es or (n)o: y (user input – note: allow for y,Y, n,N)
Record deleted. (This message is displayed only after this record has been successfully deleted from the
records file. (If the user answer is n then the main menu is displayed again. Then if the user enters Q or q
then the script is terminated.)
KIT501 ICT Systems Administration Fundamentals Unix Scripting Assignment
9
General Requirements
You must:
• Include your full name, student ID, and a brief introduction of what the script does in all
your shell scripts, as a comment in the beginning of each script.
• Make your scripts run on the Bourne shell, regardless of which shell the user of your
scripts is currently using.
• Add in-line comments to help other people understand your scripts.
• Use newlines ("\n") where appropriate to make the output of your scripts more
readable.
• Note that your script structure and layout are also important as they will be marked as
part of the assessment process.
Submitting Your Assignment
You must submit (copy) a single folder named kit501a2 which contains the following three (3)
files to the kit501submit folder which will be automatically created for you in your ictteach
account:
cp2.sh, menu.sh, records
Please ensure your kit501a2 folder only contains the three files as listed here, when you are ready
to submit your assignment.
Ø WARNING: Do not create the kit501submit folder. It will be created for you
closer to the submission date. If you create this folder yourself, it will cause your
assignment to not be submitted correctly1
. In the week prior to the assignment
due date, if the kit501submit folder does not exist, please advise the Unit
Coordinator. Without a kit501submit folder, you will NOT be able to submit
your assignment. If you see this folder in your home directory, DO NOT DELETE
IT.
To submit your assignment, follow these two steps:
1. Ensure that both your kit501a2 folder and the kit501submit folder are present under
your home directory (see the warning above);
2. Type the following commands to copy your kit501a2 folder into your kit501submit
folder (the $ is the shell prompt):
1 Why? The kit501submit folder is actually a soft-link to another folder elsewhere in the filesystem. If you
create the folder yourself, it will not be linked to the correct submission master folder, meaning your
assignment will not be discovered or marked.
KIT501 ICT Systems Administration Fundamentals Unix Scripting Assignment
10
$ cd (This takes you back to your home directory
from anywhere)
$ cp -r kit501a2 kit501submit (This copies your assignment folder into your kit501submit
folder. The option -r is important)
$ ls -l kit501submit (This verifies that your assignment folder is now in your
kit501submit folder)
$ ls -l kit501submit/kit501a2 (This verifies that your assignment files are now in your
kit501submit folder)
If your assignment is late then you should submit your files to the kit501late folder. This
late folder will be created immediately after the assignment due date and it will be available
for one week only. Do not create this folder yourself, it will be created automatically.
Need Help?
You are encouraged to seek assistance from your lecturer or tutor after you have seriously thought
about the assignment. Please note that we can provide general advice – but you are expected to
write and debug (correct) your own code.
Ø Note: all of the knowledge you need for this assignment will have been discussed in the
unit's practical classes (up to and including week 10). Shell functions are discussed in
week 11 but you are not required to use these in your assignment. You do not need to
find additional syntax or commands from other sources (such as other websites
discovered via search engines like google). You are also expected to write your script
solutions using the particular methods of syntax as discussed in the unit.
Plagiarism
Plagiarism is a very serious matter, and ignorance of this is not an excuse. If you submit work
claiming it to be your own, and it is not original work of your own, this is cheating. This means for
example that you cannot submit code written by other students or sourced from the Internet and
claim you wrote the code yourself. Plagiarism can result in academic penalties both in relation to
your assignment, and also on your permanent university record.
Acknowledgements:
This assignment has been re-formatted and slightly modified from an assignment written by Dr
Shuxiang Xu.
KIT501 ICT Systems Administration Fundamentals Unix Scripting Assignment
11
KIT501 Assignment Marking Scheme
cp2.sh (for each item there are only 3 possible marks: 100% or 50% or 0%) Mark Out of
Execution of the shell script
Script runs as expected (2).
Script runs but not as expected (1).
Script does not run (0)
2
Check that dir1 and dir2 currently exist and that dir3 does not currently exist. 2
Copy all files from dir1 into dir3 2
Copy new files from dir2 into dir3 2
Copy newer files from dir2 to dir3 and overwrite older versions 2
menu.sh (for each item there are only 3 possible marks: 100% or 50% or 0%) Mark Out of
Execution of the shell script
Script runs as expected (2).
Script runs but not as expected (1).
Script does not run (0)
2
Correctly set up a loop to repeatedly display the menu 2
Correctly display all records 2
Correctly search for specific records 2
Correctly add new records 2
Validate each field of a new record correctly when adding new records 2
Correctly delete records 2
Common (for each item there are only 3 possible marks: 100% or 50% or 0%) Mark Out of
Shell scripts structure and layout
Clear and tidy (4).
Somewhat messy but understandable (2).
Messy, confused, inconsistent (0)
2
Both scripts include name, ID, and brief introduction 2
Appropriate in-line comments 2
Assignment Total: /301
COMP2120/COMP6120 SOFTWARE ENGINEERING
Semester 2, 2020
Individual Assignment: “CleanIT”
Due 17:00 on Tuesday, 20/October/2020
ALMOST FINAL DRAFT v.2.0, 20/09/2020
Design Class Diagrams for CleanIT
In your group assignment, you constructed Domain Models and Sequence Diagrams for the CleanIT
aircraft cleaning system. You will assume a Layered Software Architecture when building your Design
Class Diagrams.
In this individual assignment you will extend your group work by drawing up a Design Class
Diagrams. These Design Class Diagrams will start to look very much like computer software. They will
need to reflect the “real world” of your Domain Model but they will include extra classes, linkages
and details to fully explain how the Domain Layer of your system might look.
Note that you must state what your Group Number was when submitting your individual
assignment.
Task 1
Draw up a Design Class Diagram for the base system (without the extension class) that your group
has developed in the Group Project. Assume that you will have a layered software architecture in
your system. (5 marks)
- You need to include an explanation of your Design Class Diagram that justifies how it will
support your major use cases (Tasks 1-6) and explain how it displays evidence of good
software design.
- If you have used any management classes or Design Patterns in your Design Class Diagram,
justify why including these design patterns makes your design better.
Task 2
Explain, without drawing it completely but perhaps using some illustrations, how your Design Class
Diagram will need to be modified to support the extension task (Task 7) that your group undertook.
(3 marks)
-As with Task 1, Include an explanation that justifies why your modified Design Class
Diagram is a good one. In particular, if you have used any management classes or Design
Patterns, justify why they make the design better.
Task 3
Over the lifetime of the CleanIT system, one could imagine that the software will need to evolve
further to incorporate new requirements. Describe one example of substantial new requirements
that could be realistic in the future and how your Design Class Diagram will be able to respond well
to these new requirements. (2 marks)
-Your example should be a longer term modification that would require some major reengineering
and involve a modification of the vision statement in a way that you imagine
2
this business evolving in the future. Describe, in general terms, how that modification to the
business requirements would affect the engineering of your Design Class Diagram.
Note: You are not expected to draw lots of diagrams for Task 3 if you can explain your ideas clearly.
But you are welcome to include some diagrams if that helps with your explanation.
Marking guide
Task 1. Design Class Diagram for Tasks 1-6 of the Group Assignments (Up to 5 marks)
a. 5.0 marks for excellent work, professionally- presented, apart from one or two very
minor issues. Your Design Class Diagram will be clearly labelled.
i. Linkages will be reasonable and be as few as necessary to support
the use cases and the sequence diagrams in your group assignment.
Multiplicities will be correct.
ii. You will have also submitted a statement explaining why your
diagram is a good one. This statement will read clearly and your
explanations will show realism, imagination and depth. You will
convince the reader that you have come up with a good design that
integrates well with a layered architecture.
b. 4.0 marks for very good work apart from a small collection of serious issues (perhaps two
or three serious issues). Examples are:
i. Perhaps your diagram does not integrate well into a layered
architecture.
ii. Perhaps your diagram is a bit cluttered and it does not reference
your domain model sufficiently.
c. 3.0 for a Design Class diagram that looks OK but doesn’t really support all of your
sequence diagrams and use cases, but with a good and thoughtful explanation which
makes it clear that you have thought deeply about the task.
d. 2.0 marks for a design class diagram that is vaguely OK but is not much more than a
simple iteration on your Domain Model and doesn’t really support your sequence
diagrams. Your accompanying explanation might be a bit weak as well.
e. 1.0 marks for a quite superficial submission but with some obvious thought involved.
f. 0.0 marks for an absent submission.
g. Half marks will be used where it is not clear which category is appropriate for the
submission.
Task 2. Design Class Diagram for Task 7 of the Group Assignments (Up to 3 marks)
a. 3.0 marks for excellent work, professionally- presented, apart from one or two very
minor issues. Your Design Class Diagram will be clearly labelled. You will have also
submitted a statement explaining why your diagram is a good one. This statement will
3
read clearly and your explanations will show realism, imagination and depth. You will
convince the reader that you have come up with a good design that supports the Task 7
of your group assignment.
b. 2.0 marks for good work apart but with a small collection of serious issues (perhaps two
or three serious issues). Examples are:
i. Perhaps your diagram does not really represent the ideas in your
group assignment as well as it might.
ii. Perhaps your diagram is a bit cluttered and it does not reference
your domain model sufficiently.
iii. Perhaps you have not used good design principles to isolate and
protect parts of your software.
c. 1.0 marks for a quite superficial submission but with some obvious thought involved.
d. 0.0 marks for an absent submission.
e. Half marks will be used where it is not clear which category is appropriate for the
submission.
Task 3. Future evolution of your Design Class Diagram (Up to 2 marks)
a. 2.0 marks for an excellent explanation that is very convincing in your choice of your
example and that convinces the reader that you have thought deeply about how your
Design Model can be evolved. Your example will be very realistic and credible.
b. 1.0 marks for an OK answer to this question but perhaps your examples was not very
convincing or perhaps you were not able to justify your explanations of how the Design
Class Diagram would evolve.
c. Half marks will be used where it is not clear which category is appropriate for the
submission.
Differential assessment for relative efforts in the Group Assignment based on marks for this
individual assignment by different group members.
This assignment will be marked out of 10. It will be your own, individual mark.
We will look at the differential spread of marks across all members of all groups for this individual
assignment.
Where this spread is greater than or equal to 20% (i.e. greater than or equal to plus or minus 10%
about the average mark for all group members) and where there is zero existing variation in the
marks for the group assignment (that is, all group members have the same mark for the group
assignment), then marks for the group assignment will be varied in proportion to the variation for
student’s individual assignments up to a limit of plus or minus 10% of the group mark.

联系我们 - QQ: 99515681 微信:codinghelp
程序辅导网!