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

This assignment is worth 6 points total, partial credit will be given, *********

ID: 3863409 • Letter: T

Question

  This assignment is worth 6 points total, partial credit will be given,      *****************************************************    *   USE UBUNTU TERMINAL MODE COMMANDS ONLY          *    *   DO NOT USE ANY EDITORS TO CREATE THIS PROGRAM   *     *****************************************************     1) Create a file called lastNameFirstNameInitialpgm3.sh  ex: robinsonMpgm1.sh  2) Append to the above file the necessary commands that when this file is executed     it will display the following:  - Using your own set of multi-line comments enter your program identification    as described in the Syllabus, example:      <<ID   **************************************************    Author   : Your Name    Course   : Course Name and Times    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.    **************************************************   ID    - Append to the file the following commands that when this file is executed it will do the following:       1) Display Please enter any number  2) Display Your number $number * 2 = XXX and display press any key to continue  3) Display a new clean screen        4) Display Enter a line of numbers to be added  5) Using enhanced for loop, display all numbers entered delaying the output     of each number by 1 second each and then the total of adding thoses numbers:     ex: 20 5 3 = 28  6) Using a while true loop request, accept and display data until it ends on      input mod 5 = 0     using -lt and -gt comparison commands     this uses if else     

Explanation / Answer

#!/bin/bash

<<IDNUMBER
**************************************************
Author   : Zubaeyr
Course   : Operating Systems
Professor: Michael Robinson
Program : Program Number, Purpose/Description
             A brief description of the program
Due Date : 18/03/2017

I certify that this work is my own alone.
**************************************************
IDNUMBER

# read an integer and display the final result
read -p "Enter any number : " input_number
echo "Your number $input_number * 2 = " $((input_number * 2))
read -p "Press any key to continue : " input_number


# clear the screen
clear


# read a line of numbers and display them with their sum
echo "Enter a line of numbers to be added : "
read -a array
sum_of_numbers=0

for a in ${array[@]}
do
   printf '%d ' $a
   sum_of_numbers=$(expr "$sum_of_numbers" + "$a")
   sleep 1
done
printf ' = %d ' $sum_of_numbers

# read input continuously
while true
do
   read -p "Enter a number : " input_number
   printf "your number is %d " $input_number
   if (( $input_number % 5 == 0 ))
   then
        exit
   fi
done