CIS129
CIS129 Project 3
1. Write a script that will take 2 numbers (sides of a triangle) from an input file and calculate the
hypotenuse, using the "C" or C++ program PROVIDED later in these directions.
2. Name your script: project3.sh
3. 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. Example: #!
in/sh
) If the user gives 2 numbers on the command line (arguments), the script will use the two
numbers as input, and not use the data file.
c) You must use a loop structure when processing the data file.
d) The actual conversion and print will take place in the C or C++ program PROVIDED.
e) Other outputs, such as information and headings, will take place in the script.
f) The data file is below, as shown in item 5.
g) You must use at least one function in the script
h) All columns of output should line up, with the identified headings.
i) Fully document (comment) all functions and operations within the script.
4. The compiled program along with the source program is available on the server at:
opt/cis129/fulton/project3. There should be three files in that directory. The executable is called
hyp. The source code is in the hyp.cpp file if you would like to look at it, but it is not needed.
There is also the data file for this project, project3.input.
NOTE: Copy the files in the above directory to your home directory to use for the project.
WARNING! You can not use Filezilla to copy the files, that is an FTP program! You must use
the cp command you learned in Section 4!
Example: cp source location and files destination location
Remember, when you login to the cislinux server, you are in YOUR HOME DIRECTORY! So to
copy the files, you just have to specify where you want to copy (cp) the files from (source)
(/opt/cis129/fulton/project3/*) and put them where you are (destination) (in your Home directory,
which is your cu
ent directory specified by a . (period)).
CIS129 Project 3
5. The contents of the input data file is shown below: project3.input
10 10
32 47
90 10
3 4
6. The output of the script will be as follows:
a) If the user provided 2 numbers AT THE COMMAND LINE (10 and 10) as parameters,
the output will be sent to: project3.ui.output
Make sure to include the typical project header information in your output
Things like Project #, Name, Date, etc.
The data was calculated from user input:
First side Second side Hypotenuse
************************************************
XXXXXXXXXX
) If the user did NOT provide Command Line Parameters as input then the data file and
the output will be sent to: project3.df.output
Make sure to include the typical project header information in your output
Things like Project #, Name, Date, etc.
The data file was processed:
First side Second side Hypotenuse
************************************************
XXXXXXXXXX
************************************************
XXXXXXXXXX
************************************************
XXXXXXXXXX55
***********************************************
XXXXXXXXXX
7. When you have completed the project, upload 4 files.
a) project3.sh
) project3.input
c) project3.ui.output (With user input value results)
d) project3.df.output (Reading data file for inputs)