Answered You can hire a professional tutor to get the answer.
trying to make a script that will show me the output like the one below 1.
trying to make a script that will show me the output like the one below
1. Write a script, which will take 2 numbers (sides of a triangle) from an input file or command line and calculate
the hypotenuse, using the "C" program later in this project. 2. Requirements of the script. a) You can use any shell for processing the script. The shell must be identified on the first line of the script. b) If the user gives 2 numbers on the command line (arguments/parameters), the script will use the two
numbers as input, and not use the data file. c) The actual conversion will take place in the compiled program given to you. d) The data file is below, as shown in item 5. e) You MUST use at least one function in the script. f) All columns of output should line up, with the identified headings. g) Fully document all functions and operations within the script. h) Your script MUST be “project3.sh” i) Your output MUST be “project3.output”
The script should use "echo" or “printf” statements to display your name, title and any messages you use in the script.
Example output:
echo ”*******************************************” >project3.output echo “* CIS129 Project 1 Your Name *”>>project3.output echo “* Date *”>>project3.output echo “*******************************************”>>project3.output
3. The compiled program along with the source program is available on the CIS server at /tmp/fulton/project3
4. The contents of the input data (project3.input) file is shown below: 10 10 32 47 90 10 35 25 45 12
The output of the script will be as follows:
a) if the user provided 2 numbers (10 and 10) as arguments, the output will be:
The data was calculated from user input:
First side Second side Hypotenuse 10 10 14.14
b) If the input was provided from the data file:
The data file was processed:
First side Second side Hypotenuse 10 10 14.14 ************************************************ 32 47 56.86 ************************************************ 90 10 90.55 etc…..
6) Deliverables:
a) Upload your fully functioning script (project3.sh), input file (project3.input) and output (project3.output) from BOTH types of runs to Moodle.
**************************************************************************
This is the c program. You do NOT need to compile the program as the program is already available.
#include <stdio.h> #include <math.h> // this program will calculate the hypotenuse //given 2 numbers
// start the main function int main (int argc, int *argv[] ) { //Declare the variables for each side int a = atoi(argv[1]); int b = atoi(argv[2]); //calculate the hypotenuse float c = sqrt((a*a)+(b*b));
//make the output back to the calling program printf("%2.2fn",c); return 0; } // end of program