Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted!
- The problem statement, all variables and given/known data:
A) Write a script, which will take input from a file and convert the number from Centigrade to Fahrenheit and from Fahrenheit to Centigrade.
B) Requirements of the script.
1) Your data file is shown in item C.
2) The initial and converted numbers should line up in the center of the proper headings.
3) Numbers should be rounded to the nearest whole number.
4) You must use a looping structure.
5) Fully document all functions and operations within the script and in your program source code.
6) You need to have at least one script call another script and pass command line parameters. �). That second script should perform the calculations from Fahrenheit to Centigrade or from Centigrade to Fahrenheit. (Note�It�s ok to have two, one for each conversion)
C) The contents of the input data file shown below:
1
8
22
43
89
283
120
212
1043
100
287
4) Sample output of the data. Other outputs as your name and date would be additional.
Centigrade Temperature Fahrenheit Temperature
number centered here number centered here
#(can't get them centered, each number should be centered under where it belongs and to the other side it should shows what the number is in centigrade (1F is 17C)
Fahrenheit Temperature Centigrade Temperature
-------------------------------- ---------------------------------
1 - 17
8 - 13
22 - 5
43 6
89 31
283 139
120 48
212 100
1043 561
100 37
287 141
- Relevant commands, code, scripts, algorithms:
f=`echo -e "scale=0\n($C*9/5=32)"|bc -1`
echo -e
for in loop
Centigrade to Fahrenheit C = (F - 32) * 5/9
Fahrenheit to Centigrade F=C*9/5+32
- The attempts at a solution (include all code and scripts):
the input file is in "inputfile"
scale=0\n to make sure it's rounded.
to convert Centigrade to Fahrenheit
echo -e " Centigrade Temperature \tFahrenheit Temperature " >inputfile.out
for C in `cat inputfile`
do
f=`echo -e "scale=0\n(C*9/5+32)"|bc -l`
echo -e " $C \t$f " >>inputfile.out
done
- Complete Name of School (University), City (State), Country, Name of Professor, and Course Number (Link to Course):
Old Dominion University Norfolk, VA USA Steven Zeil, CS 252
Note: Without school/professor/course information, you will be banned if you post here! You must complete the entire template (not just parts of it).