Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

This program is worth 6 points total. Partial credit will be given. 1 - Worth 0.

ID: 3738154 • Letter: T

Question

 This program is worth 6 points total. Partial credit will be given.   1 - Worth 0.5 point.      Using your Linux OS download, to your user root folder, the following file:     http://users.cis.fiu.edu/~mrobi002/downloads/HumanGenome/VenterGraig/VGuncompressed/hs_alt_HuRef_chr10.fa      2 - Worth 0.5 point.      At your user root folder create a shell file named as follows:          YourLastNameFirstNameInitialOSpgm3.sh     that **** WHEN EXECUTED **** will do the following:          and using multi line comment document your program withe following information:     **************************************************      Author   : Your Name      Course   : Course Name and Section       Professor: Michael Robinson      Program  : Program Number, Purpose/Description                 A brief description of the program      Due Date : mm/dd/yyyy       I certify that this work is my own alone.      **************************************************  3 - Worth 0.5 point.      Display your name and your program name          4 - Worth 0.5 point.      Add your name and your program name into a file named YourLastNameFirstNameInitialOSpgm3.txt  5 - Worth 0.5 point.      To your *.txt file add the amount of amount of records found in the hs_alt_HuRef_chr10.fa  6 - Worth 0.5 point.      Create a 0 (zero) byte file called YourLastNameFirstNameInitialOSpgm3.zero  7 - Worth 0.5 point.      Add to your *.txt file, your user name and file location  8 - Worth 0.5 point.      If your *.fa file exists and has data in it      Add to your *.txt file,  "my *.fa file exists and has data in it"       9 - Worth 1 point.        - Use a for loop from 1 to 100.       - Find the total amount of all the results of calculating each number         from (1 to 100 mod 5) + 3.      - After the for loop ends, display the average for all previous results and        append them to your *.txt file.  10 - Worth 1 point.       - Implement division by 0, with error trapping, using IF, WHILE and any         other needed commands,              How:      - Append your name, current date and time to your *.txt file      - Create two variables FirstNumber and SecondNumber      - If the user enters the value 55 for the first or the second number, you must        terminate this implementation of divide by 0, immediately.       - Ask the user to enter the first number and check its value.      - Ask the user to enter the second number and check its value.      - If the second number is ZERO inform the user and ask for a correct second number.      - If the second number is NOT a zero, do the division, display all numbers in this        computation using labels, and add them to your *.txt file.         Program submission  ==================  Upload your *,sh file to moodle  Print your *.sh program and turn it into class on the due date.  DON'T FORGET STAPLING.                                               

Explanation / Answer

Hi, Please find my Answer.

Please rate my answer:

Hi,

Here is the code that you are looking for. Comments are inline for your reference. Let me know if you need any help.
I have tested the code on Ubuntu Linux and the output is at the end of this answer.

wget -P ~ http://users.cis.fiu.edu/~mrobi002/downloads/HumanGenome/VenterGraig/VGuncompressed/hs_alt_HuRef_chr10.fa

Explanation: You can use either wget or curl to download the file to user root folder. The -P argument to wget command ensures that the download file is saved to the specified folder, which in this case is the user's home folder (represented as ~)

Next,

Create a file in user's root folder with file name as YourLastNameFirstNameInitialOSpgm3.sh (replace last, first name and initials)

Copy the following to the above file.
chmod +x YourLastNameFirstNameInitialOSpgm3.sh
execute as ./YourLastNameFirstNameInitialOSpgm3.sh

--------------- Start from following line ------------------
#!/bin/bash

#1
#wget -P ~ http://users.cis.fiu.edu/~mrobi002/downloads/HumanGenome/VenterGraig/VGuncompressed/hs_alt_HuRef_chr10.fa
#You can use either wget or curl to download the file to user root folder. The -P argument to wget command ensures that the download file is saved to the specified folder, which in this case is the user's home folder (represented as ~)



#2 (replace the contents with relevant values)
: <<'comment'
**************************************************
Author : Your Name
Course : Course Name and Section
Professor: Michael Robinson
Program : Program Number, Purpose/Description
A brief description of the program
Due Date : mm/dd/yyyy
I certify that this work is my own alone.
**************************************************
comment
#Multi-line comment are in the above format : <<'string' .....<comments>...... string

#3 (replace values of LASTNAME and FIRSTNAME with that of yours)
LASTNAME="Meyer"
FIRSTNAME="John"
PROGNAME=$0
echo "Hi. I am "$FIRSTNAME $LASTNAME
echo "Program name: "$PROGNAME
#Displays your name and the program name on the console

#4
TEXTFILENAME=$(basename "$PROGNAME" ".sh").txt
echo "Hi. I am "$FIRSTNAME $LASTNAME >> $TEXTFILENAME
echo "Program name: "$PROGNAME >> $TEXTFILENAME

#Creates a text file in the required format and writes your name and program name to it

#5
REC_COUNT=$(wc -l < hs_alt_HuRef_chr10.fa)
echo "Num of records in hs_alt_HuRef_chr10.fa:" $REC_COUNT >> $TEXTFILENAME

#Counts the number of records (lines) in the downloaded file and writes the results to the text file

#6
ZEROFILENAME=$(basename "$PROGNAME" ".sh").zero
touch $ZEROFILENAME
#Creates a zero size file


#7
USERNAME=$(id -un)
#FILE_LOCATION=$(dirname $PROGNAME)
FILE_LOCATION=$(realpath $PROGNAME)
echo "User name:" $USERNAME >> $TEXTFILENAME
echo "File location:" $FILE_LOCATION >> $TEXTFILENAME

#Writes the username and the location of the file to text file

#8
if [ -s hs_alt_HuRef_chr10.fa ]
then
echo "my hs_alt_HuRef_chr10.fa file exists and has data in it" >> $TEXTFILENAME
fi
#Checks (-s) if the file exists and contains data and then write the given string to the file

#9
SUM=0
for i in {1..100}
do
result=$((i%5+3))
SUM=$(($SUM+result))
done
AVERAGE=$(($SUM/100))
echo "Average:" $AVERAGE >> $TEXTFILENAME
# Calculates the sum of the given expression (for 1 to 100) and then the average and writes the result to the text file

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote