Final Projects for BCS 215
Fall 2018
/
CRN 23797
(Tuesdays & Thursdays, 1:40-2:55pm)
|
NOTE CHANGE IN DUE DATE:
- Files named three,
four,
and
five
must be in your sub-directory named
final/
-
on the server at
farvlu.farmingdale.edu
-
by 6pm Monday, May 14 th
Completion of the Final Exam in-class
will begin at 1:10pm on Thursday May 17.
three
Write a bash shellscript
to do the following:
(Be sure to start with a "shebang" to identify the shell language
and comment line(s) to state the purpose of your script and identify the author.)
- Ask for the name of the user.
- Request three different numbers.
If a duplicate number is entered, reject it and ask again.
Include the user's name in all error messages.
- Compute and display the sum of the three numbers.
- Display all three numbers in order, from smallest to largest.
- Determine whether or not these three lengths can form a triangle.
(In a triangle, each side must be less than the sum of the other two sides.)
- Determine whether or not these three lengths can form a RIGHT triangle.
(The 3 sides of a right triangle must be a Pythagoran triple:
The square of largest must be equal to the sum of the squares of the other two!)
four
NOTE:
In my sub-directory named
bam,
there is a file named
presidents.
(My username is
martinb.)
Write a bash shellscript named
four,
to output answers to the following questions,
with only one line per answer:
- Your name.
- Today's date.
- The host name of the unix system you are using.
- The full path to your home (login) directory.
- Your disk usage: your total disk usage, summarized on one line only.
- How many lines in my presidents file
contain the string "John".
- How many lines in my presidents file
contain the string "Johnson".
- How many Presidents or Vice Presidents were named "James"?
- How many Presidents or Vice Presidents were named "Clinton"?
- Ask the user to enter two different names,
then count the number of Presidents and Vice Presidents who have that name,
and answer which name is more common
(i.e., which name appears on more lines of the presidents file).
five
NOTE:
The file named
presidents
[see above]
contains the full names of all Presidents and Vice Presidents.
Write a bash shellscript named
five,
to obtain two names from the command line
(instead of reading them in),
then count the number of Presidents or Vice Presidents who have that name,
and answer which name is more common.
Create an empty file named "answers"
and run your script with each of the following command lines,
appending the outputs to the "answers" file.
- five John James,
- five George James,
- five Richard Thomas,
- five Franklin Dan,
Append a fifth line to the answers file,
with the number of lines in presidents
that do NOT contain any of the following names:
- James
- John
- George
- William