Tolls and Hot Water

These are the 2 new math problems.

01c: FORMULA: VAR1*((VAR2*2)/VAR3) VARIABLES: 3 PROB: If you drive VAR1[INT,1,25]VAR1 times per month to school, and each trip is VAR2[FLOAT,1,10]VAR2 miles each way, and your vehicle gets an average of VAR3[FLOAT,10,60]VAR3 miles per gallon, how many gallons of gas do you need in one month?
02c: FORMULA: VAR1*VAR2 VARIABLES: 2 PROB: If you eat VAR1[INT, 1,6]VAR1 slices of pizza, and each slice has VAR2[INT,100,300]VAR2 calories, how many calories do you have to burn to work off the pizza?
03c: FORMULA: VAR1*VAR2*2/VAR3 VARIABLES: 2 PROB: If you have to spend VAR1[INT, 1,5]VAR1 hours taking care of your dog in order to get a movie ticket, and each session with the dog is VAR2[INT,1,30]VAR2 minutes, how many sessions with your dog do you need to do before you can go to the movies?
04c: FORMULA: VAR3*VAR2*VAR1+VAR1*VAR2 VARIABLES: 3 PROB: If there are VAR1[INT,-30,30]VAR1 percent more African Americans in US colleges than in prison, and there are VAR2[INT,10,30]VAR2 million African Americans in the US and 1 in VAR3[INT,1,25]VAR3 African Americans is currently behind bars, how many African Americans are in college the US?
05: FORMULA: VAR1*VAR2*2/VAR3 VARIABLES: 3 PROB: If grass requires VAR1[FLOAT, 0,3]VAR1 inches of rain per week to survive, and 10 goats requires VAR2[FLOAT,1,3]VAR2 acres of grass to graze, how many inches of rain is required to sustain VAR3[INT,1,100]VAR3 goats?
06c: FORMULA: VAR1*VAR2*2/VAR3 VARIABLES: 2 PROB: If the territory of a specific bird is VAR1[INT, 10,100]VAR1 acres and it shrinks by VAR2[FLOAT,1, 90]VAR2 %, how many acres are left in its territory?
07c: FORMULA: VAR1*VAR2*2/VAR3 VARIABLES: 2 PROB: If VAR1[INT, 5000,50000]VAR1 animals are currently in US animal shelters, and animals are adopted at a rate of VAR2[FLOAT, 0, 20]VAR2 thousand per week, how many days would it take before all animals were adopted if no more animals came in?
08c: FORMULA: VAR1*VAR2*2/VAR3 VARIABLES: 3 PROB: If your running time improves by VAR1[FLOAT, 0, 1]VAR1% every time you work out and you work out every other day, how many days are required before your running time drops from a VAR2[FLOAT, 12, 16]VAR2 minute mile to a VAR3[FLOAT, 2, 6]VAR3 minute mile?
09c: FORMULA: VAR1*VAR2*2/VAR3 VARIABLES: 4 PROB: If you increase the room temperature by VAR1[INT, 1, 3]VAR1 degrees on the thermostat in the summer, and every degree corresponds to VAR2[INT, 50, 200]VAR2 joules/sec, how many trees will you save in VAR3[INT,1,30]VAR3 days, if one tree is the carbon-energy equivalent of VAR4[INT, 20,70]VAR4 mega-joules?
10c: FORMULA: VAR1*VAR2*2/VAR3 VARIABLES: 3 PROB: If a gray whale migrates from Alaska to Mexico travelling a distance of VAR1[INT, 4500, 6500]VAR1 miles in VAR2[INT,60,120]VAR2 days to give birth to a calf, and then migrates back up the coast back to Alaska with the calf at VAR3[INT, 20, 80]VAR3 percent of its original speed, how many days will the round trip take?
11c: FORMULA: VAR1*VAR2*2/VAR3 VARIABLES: 6 PROB: If VAR1[INT, 2, 50]VAR1% of your potato crop will be destroyed by bugs, and you plant VAR2[INT, 40, 500]VAR2 potato plants, each of which is expected to produce VAR3[INT, 3, 16]VAR3 potatoes that weigh VAR4[FLOAT, 0, 1]VAR4 pounds, how many days will the harvest feed VAR5[INT,1,10]VAR5 people if 50 pounds of potatoes feeds VAR6[INT,50,150]VAR6 people for a day ?
12c: FORMULA: VAR1*VAR2*2/VAR3 VARIABLES: 6 PROB: A VAR1[INT, 3000, 6000]VAR1 Watt water heater is the primary source of energy consumption in a household that does not heat during the winter and only uses air conditioning in one room during the summer.  The heater consumes the energy equivalent of VAR2[INT, 82, 160]VAR2 gallons of gas per year (30% of household energy). How many round-trip medical trips of VAR3[INT,5,40]VAR3 miles each way in a VAR4[INT, 10,40]VAR4 mpg vehicle, will turning off the hot water heater for the warmest VAR5[INT,3,8]VAR5 months of the year provide in one year, assuming that the energy of heating the water during these summer months is VAR6[INT, 50, 80]VAR6 % of what it is during the winter?
13c: FORMULA: VAR1*VAR2*2/VAR3 VARIABLES: 4 PROB: If you pick up VAR1[INT, 0, 12]VAR1 quarters (each quarter is 25 cents), VAR2[INT, 0, 20]VAR2 dimes (each dime is 10 cents), VAR3[INT, 0, 20]VAR3 nickels (each nickel is 5 cents), and VAR4[INT, 0, 200]VAR4 pennies (each penny is 1 cent), how many dollars-worth of change do you have (100 cents are in a dollar)?
14c: FORMULA: VAR1*VAR2*2/VAR3 VARIABLES: 7 PROB: Your local animal shelter has a euthanasia rate of VAR1[INT, 0, 12]VAR1 cats per week of those that enter, and VAR2[INT, 2, 20]VAR2 cats/day are brought into the shelter with an adoption rate of VAR3[INT, 10, 80]VAR3 percent of those that enter. VAR4[INT, 0, 120]VAR4 cats are currently at the shelter.  How many cats will there be at the shelter in VAR5[INT, 1,30]VAR5 days if the euthanasia rate is lowered by VAR6[INT, 0, 100]VAR6 % and the adoption rate is raised by VAR7[INT, 0, 100]VAR7 %.
15c: FORMULA: VAR1*VAR2*2/VAR3 VARIABLES: 8 PROB: Your stride length is VAR1[INT, 12,40]VAR1 inches.  It takes you VAR2[FLOAT, 2, 4]VAR2 minutes and VAR3[INT, 100, 400]VAR3 steps to walk around the perimeter of your yard, and VAR4[FLOAT,1,3]VAR4 times as long to push a lawn mower with a VAR5[INT, 16, 70]VAR5 inch blade around the perimeter. Your first pass around the yard with the mower cuts the entire blade range leaving a VAR6[INT, 0, 5]VAR6 inch “dead area”. How many hours will it take you to mow the lawn in a circular fashion assuming that each subsequent pass around the yard cuts VAR7[INT, 60, 80]VAR7% of the blade length, and that your speed decreases by VAR8[FLOAT, 1,4]VAR8 % with each pass?
16c: FORMULA: VAR1*VAR2*2/VAR3 VARIABLES: 8 PROB: You cook on the average VAR1[FLOAT, 0, 3]VAR1 times a day, for an average of VAR2[INT, 30, 100]VAR2 minutes/time when you use your big cooking oven. A cooking oven is VAR3[INT, 15,40]VAR3 times the size of a toaster oven, requiring on the average VAR4[INT, 1000, 2000]VAR4 Watts/sec of use.  An electric radiator uses VAR5[INT, 1200, 2400]VAR5 Watts/sec.  Assuming that the energy use of the oven is proportional to its volume and that the toaster oven needs VAR6[FLOAT, 5, 20]VAR6% of the time that the main oven needs to cook, how many hours of the day can you use the radiator in a room if you heat for VAR7[INT, 1, 5]VAR7 “30-day” months with the energy saved by using a toaster oven VAR8[INT, 2, 10]VAR8 times more often than you use the main oven for a year?
17c: FORMULA: VAR1*VAR2*2/VAR3 VARIABLES: 9 PROB: You are squatting in a trailer connected to a VAR1[INT, 750, 1200]VAR1 gallon septic system with VAR2[INT, 0, 10]VAR2 other people.  Although there is enough electricity for a little water pump, the power to the sewage system water pump has been disconnected.  The faucets have been turned down so that the water flows at a rate of VAR3[FLOAT, 0, 2]VAR3 gallons/min.  Assuming an average washing time of VAR4[FLOAT, 0, 5]VAR4 minutes per person/day, VAR5[FLOAT, 0, 10]VAR5 minutes per person/day for cooking and cleaning, VAR6[FLOAT, 0, 5]VAR6 flushes per person/day with a VAR7[FLOAT, 1, 6]VAR7 gallon toilet, and VAR8[FLOAT,0,1]VAR8 loads of laundry per day in a VAR9[INT, 18, 55]VAR9 gallon per load washing machine, how many days before the sewage system is full?
18c: FORMULA: VAR1*VAR2*2/VAR3 VARIABLES: 9 PROB: You are making vegetarian tamales.  The cost of masa flour is $VAR1[FLOAT, 2, 3]VAR1 for a 2 kg bag.  You mix this with cold vegetable broth which costs $0.60.  A bag of 120 corn husks costs $VAR2[FLOAT, 3, 6]VAR2.   You need VAR3[INT, 2, 4]VAR3 queso frescos, each of which costs $VAR4[FLOAT, 3, 4]VAR4, and 0.7 lbs of tomatoes ($VAR5[FLOAT, 1, 2]VAR5/lb), 1.5 lbs squash ($VAR6[FLOAT, 0, 2]VAR6/lb), 1 can of black beans ($VAR7[FLOAT, 0, 2]VAR7/can), 4 ears of corn at ($0.25/ear), cilantro ($VAR8[FLOAT, 0, 2]VAR8/bunch), and 0.02 lb of hot peppers ($3.99/lb).  From this, one can steam VAR9[INT, 80, 120]VAR9 tamales in a steamer.  How many cents does each tamale cost?
19c: FORMULA: VAR1*VAR2*2/VAR3 VARIABLES: 9 PROB: If you get VAR1[FLOAT, 10, 60]VAR1 mpg in your vehicle, and are travelling a route that has the following 3 tolls and toll-bypasses:    toll 1: $VAR2[INT, 2, 6]VAR2     bypass VAR3[INT, 2, 6]VAR3 extra miles,    toll 2: $VAR4[INT, 2, 6]VAR4     bypass VAR5[INT, 2, 25]VAR5 extra miles,    toll 3: $VAR6[INT, 1, 6]VAR6     bypass VAR7[INT, 5, 45]VAR7 extra miles,    what is the difference in price between taking the tolls and taking the bypasses assuming that the price of gas is $VAR8[FLOAT, 3,5]VAR8 and your mpg decreases by VAR9[FLOAT, 10, 50]VAR9% when you take the bypass.
20c: FORMULA: VAR1*VAR2*2/VAR3 VARIABLES: 3 PROB: The bathtub in the place where you are staying takes VAR1[FLOAT, 25, 40]VAR1 gallons of water for a bath.  The hot water furnace has been lowered to VAR2[FLOAT, 18, 30]VAR2 degrees celcius, which is a little uncomfortable for a bath.  Although showers are generally more resource-efficient, a hot bath will increase the peripheral circulation and alimentation during colder weather in individuals with circulation problems.  You decide that heating just the water that you need for the bath is more resource-efficient than adjusting the furnace temperature, and piping the hot water through pipes.  If you want a bath temperature of VAR3[FLOAT, 35,42]VAR3 degrees celcius, how many gallons of water will you have to replace in the bathtub with boiling water?

—————————————————————————————————

#!/bin/bash
# musical_numbers.sh v.1.0 a program submitted by livedoggb on Oct. 5/2012
# dependencies compiled random1.c, and intdiv2float.c and
# itunes directory named math_music with songs that you want to use sequentially numbered 01 …, 02 …, 03 … etc.
# It also outputs a file sommaire.out that has the statistics of your session.

mnt_path=”/mnt/sdb1/”
dir_path=”$mnt_path/for_kids/musical_numbers/”
temp_path=”/root/”
temp_file=”$temp_path/temp.out”
dir_cprog=$( echo “$mnt_path/for_kids/c_progs/” )

function round_number {
check_sign=$(echo “$answer” | sed -e “s/^\(.\).*/\1/”)
check_dig_3=$(echo “$answer” | sed -e “s/\(.*\…\)\(.\).*/\2/”)
if [ “$check_dig_3” -ge “5” ]
then
if [ “$check_sign” == “-” ]
then
answer=$(“$dir_cprog”/dec_proc “$answer” 0.01 2)
else
answer=$(“$dir_cprog”/dec_proc “$answer” 0.01 1)
fi
fi
return
}

function trim_line {
i=1
echo
#num_words=$(gawk ‘{ sum += $1 }; END { print sum }’ testline.out)
words_left=”c”
while [ “$words_left” != “” ]
do
j=$(( $i + 8 ))
words_left=$( echo “$line” | cut -d’ ‘ -f$i-$j )
echo “$words_left”
i=$(( $j + 1 ))
done
return
}
PI=3.14159

function create_geometry_problem {
num_var=$( echo “$line” | sed -e “s/^.*VARIABLES: \(.\).*/\1/” )
x=$num_var
while [ “$x” -gt “0” ]
do
grpr=$( echo VAR”$(( $num_var-$x+1 ))” )
var=$( echo “$line” | sed -e “s/^.*$grpr\(.*\)$grpr.*/\1/” )
lowint=$( echo “$var” | sed -e “s/\[\(.*\),\(.*\),\(.*\)\]/\2/” )
highint=$( echo “$var” | sed -e “s/\[\(.*\),\(.*\),\(.*\)\]/\3/” )
vartype=$( echo “$var” | sed -e “s/\[\(.*\),\(.*\),\(.*\)\]/\1/” )

if [ “$vartype” == “FLOAT” ]
then
lowint=$(( 10*$lowint ))
highint=$(( 10*highint ))
var_value=$( “$dir_cprog”/random1 $lowint $highint )
var_value=$( “$dir_cprog”/intdiv2float $var_value 10 )
else
var_value=$( “$dir_cprog”/random1 $lowint $highint )
fi
var_value=$( echo “$var_value” | sed -e “s/^0//” )
line=$( echo “$line” | sed -e “s/^.* PROB://” )
line=$( echo “$line” | sed -e “s/\(.*\)$grpr.*$grpr\(.*\)/\1 $var_value \2/” )
#     echo  $grpr :  $var, $lowint, $highint, $vartype, $var_value
#       read
x=$(($x-1))
subscript=$(($num_var-$x))
numb[$subscript]=$var_value
done
answer=”not yet available.”
#   angle=$(“$dir_cprog”/dec_proc $PI 2 4 )
#   ans=$(“$dir_cprog”/dec_proc $angle 1 9 )
#   echo “test cos = ” $ans
echo “Please round your answer to 2 decimal places.”
case “$wpnum” in
default)
answer=”not yet available.”
;;
“01”)
prod3=$(“$dir_cprog”/dec_proc ${numb[1]} $PI 4)
answer=$prod3
#   answer=$(“$dir_cprog”/dec_proc $( $dir_cprog/dec_proc ${numb[1]} $prod3 3 ) ${numb[3]} 4)
#   echo $answer
;;
“02”)
prod3=$(“$dir_cprog”/dec_proc ${numb[1]} $PI 3)
prod3=$(“$dir_cprog”/dec_proc $prod3 2 3)
answer=$prod3
;;
“03”)
prod3=$(“$dir_cprog”/dec_proc ${numb[1]} $PI 3)
answer=$prod3
;;
“04”)
prod3=$(“$dir_cprog”/dec_proc ${numb[1]} $PI 4)
prod3=$(“$dir_cprog”/dec_proc $prod3 2 7)
prod3=$(“$dir_cprog”/dec_proc $prod3 $PI 3)
prod3=$(“$dir_cprog”/dec_proc $prod3 2 3)
answer=$prod3
;;
“05”)
prod3=$(“$dir_cprog”/dec_proc ${numb[1]} $PI 4)
prod3=$(“$dir_cprog”/dec_proc $prod3 $PI 7)
answer=$(“$dir_cprog”/dec_proc $prod3 2 3)
#   diameter area
;;
“06”)
prod3=$(“$dir_cprog”/dec_proc ${numb[1]} $PI 4)
prod3=$(“$dir_cprog”/dec_proc $prod3 $PI 7)
answer=$prod3
#   radius area
;;
“07”)
prod3=$(“$dir_cprog”/dec_proc ${numb[1]} 2 4)
prod3=$(“$dir_cprog”/dec_proc $prod3 $PI 3)
prod3=$(“$dir_cprog”/dec_proc $prod3 ${numb[1]} 3)
answer=$prod3
#   radius area
;;
“08”)
prod3=$(“$dir_cprog”/dec_proc ${numb[1]} 2 4)
prod3=$(“$dir_cprog”/dec_proc $prod3 ${numb[1]} 3)
answer=$prod3
;;
“09”)
prod3=$(“$dir_cprog”/dec_proc ${numb[1]} $PI 3)
prod3=$(“$dir_cprog”/dec_proc $prod3 ${numb[1]} 3)
answer=$prod3
;;
“10”)
#perimeter from circumference
prod3=$(“$dir_cprog”/dec_proc ${numb[1]} $PI 4)
prod3=$(“$dir_cprog”/dec_proc $prod3 $prod3 3)
prod3=$(“$dir_cprog”/dec_proc $prod3 2 4)
prod3=$(“$dir_cprog”/dec_proc $prod3 2 7)
prod3=$(“$dir_cprog”/dec_proc $prod3 4 3)
answer=$prod3
;;
“11”)
#area from circumference
prod3=$(“$dir_cprog”/dec_proc ${numb[1]} $PI 4)
prod3=$(“$dir_cprog”/dec_proc $prod3 $prod3 3)
prod3=$(“$dir_cprog”/dec_proc $prod3 2 4)
prod3=$(“$dir_cprog”/dec_proc $prod3 2 7)
prod3=$(“$dir_cprog”/dec_proc $prod3 $prod3 3)
answer=$prod3
;;
“12”)
#side of biggest square from circumference
prod3=$(“$dir_cprog”/dec_proc ${numb[1]} $PI 4)
prod3=$(“$dir_cprog”/dec_proc $prod3 $prod3 3)
prod3=$(“$dir_cprog”/dec_proc $prod3 2 4)
prod3=$(“$dir_cprog”/dec_proc $prod3 2 7)
answer=$prod3
;;
“13”)
#perimeter from circumference
prod3=$(“$dir_cprog”/dec_proc ${numb[1]} $PI 4)
prod3=$(“$dir_cprog”/dec_proc $prod3 4 3)
answer=$prod3
;;
“14”)
#area from circumference
prod3=$(“$dir_cprog”/dec_proc ${numb[1]} $PI 4)
prod3=$(“$dir_cprog”/dec_proc $prod3 $prod3 3)
answer=$prod3
;;
“15”)
#side of biggest square from circumference
prod3=$(“$dir_cprog”/dec_proc ${numb[1]} $PI 4)
answer=$prod3
;;
“16”)
#perimeter from circumference
prod3=$(“$dir_cprog”/dec_proc ${numb[1]} $PI 4)
radius=$(“$dir_cprog”/dec_proc $prod3 2 4)
#cos 30
angle=$(“$dir_cprog”/dec_proc $PI 6 4)
prod2=$(“$dir_cprog”/dec_proc $angle 1 8)
prod3=$(“$dir_cprog”/dec_proc $prod2 $radius 3)
prod3=$(“$dir_cprog”/dec_proc $prod3 6 3)
answer=$prod3
;;
“17”)
#area from circumference
prod3=$(“$dir_cprog”/dec_proc ${numb[1]} $PI 4)
prod3=$(“$dir_cprog”/dec_proc $prod3 2 4)
#cos 30
angle=$(“$dir_cprog”/dec_proc $PI 6 4)
prod2=$(“$dir_cprog”/dec_proc $angle 1 8)
#sin 30
prod4=$(“$dir_cprog”/dec_proc $angle 1 9)
prod4=$(“$dir_cprog”/dec_proc $prod4 $prod3 3)
prod3=$(“$dir_cprog”/dec_proc $prod2 $prod3 3)
prod4=$(“$dir_cprog”/dec_proc $prod4 2 4)
prod3=$(“$dir_cprog”/dec_proc $prod3 $prod4 3)
prod3=$(“$dir_cprog”/dec_proc $prod3 3 3)
answer=$prod3
;;
“18”)
#side from circumference
prod3=$(“$dir_cprog”/dec_proc ${numb[1]} $PI 4)
prod3=$(“$dir_cprog”/dec_proc $prod3 2 4)
angle=$(“$dir_cprog”/dec_proc $PI 6 4)
prod2=$(“$dir_cprog”/dec_proc $angle 1 8)
#cos 30
prod3=$(“$dir_cprog”/dec_proc $prod2 $prod3 3)
prod3=$(“$dir_cprog”/dec_proc $prod3 2 3)
answer=$prod3
;;
“19”)
#perimeter from circumference
prod3=$(“$dir_cprog”/dec_proc ${numb[1]} $PI 4)
radius=$(“$dir_cprog”/dec_proc $prod3 2 4)
angle=$(“$dir_cprog”/dec_proc $PI 6 4)
prod2=$(“$dir_cprog”/dec_proc $angle 1 10)
#tan 30
prod3=$(“$dir_cprog”/dec_proc $radius $prod2 4)
prod3=$(“$dir_cprog”/dec_proc $prod3 6 3)
answer=$prod3
;;
“20”)
#area from circumference
prod3=$(“$dir_cprog”/dec_proc ${numb[1]} $PI 4)
radius=$(“$dir_cprog”/dec_proc $prod3 2 4)
angle=$(“$dir_cprog”/dec_proc $PI 6 4)
prod2=$(“$dir_cprog”/dec_proc $angle 1 10)
#tan 30
prod3=$(“$dir_cprog”/dec_proc $radius $prod2 4)
prod3=$(“$dir_cprog”/dec_proc $prod3 $radius 3)
prod3=$(“$dir_cprog”/dec_proc $prod3 3 3)

answer=$prod3
;;
“21”)
#side from circumference

prod3=$(“$dir_cprog”/dec_proc ${numb[1]} $PI 4)
radius=$(“$dir_cprog”/dec_proc $prod3 2 4)
angle=$(“$dir_cprog”/dec_proc $PI 6 4)
prod2=$(“$dir_cprog”/dec_proc $angle 1 10)
#tan 30
prod3=$(“$dir_cprog”/dec_proc $radius $prod2 4)
prod3=$(“$dir_cprog”/dec_proc $prod3 2 3)
answer=$prod3
;;
“22”)
hyp=$(“$dir_cprog”/dec_proc ${numb[1]} 3 4)
hypo2=$(“$dir_cprog”/dec_proc $hyp 2 4)
prod1=$(“$dir_cprog”/dec_proc $hyp $hyp 3)
prod2=$(“$dir_cprog”/dec_proc $hypo2 $hypo2 3)
diff=$(“$dir_cprog”/dec_proc $prod1 $prod2 2)
answer=$(“$dir_cprog”/dec_proc $diff 1 7)
;;
“23”)
prod3=$(“$dir_cprog”/dec_proc ${numb[1]} 3 3)
answer=$prod3
#perimeter of eq. triangle of side x
;;
“24”)

;;
“25”)
angle=$(“$dir_cprog”/dec_proc $PI 3 4)
prod2=$(“$dir_cprog”/dec_proc $angle 1 10)
#tan 30
prod1=$(“$dir_cprog”/dec_proc ${numb[1]} $prod2 4 )
prod1=$(“$dir_cprog”/dec_proc $prod1 1 7 )
answer=$(“$dir_cprog”/dec_proc $prod1 6 3 )
;;
“26”)
angle=$(“$dir_cprog”/dec_proc $PI 3 4)
prod2=$(“$dir_cprog”/dec_proc $angle 1 10)
#tan 60
prod1=$(“$dir_cprog”/dec_proc ${numb[1]} $prod2 4 )
prod1=$(“$dir_cprog”/dec_proc $prod1 1 7 )
answer=$(“$dir_cprog”/dec_proc $prod1 2 3 )
;;
“27”)
angle=$(“$dir_cprog”/dec_proc $PI 3 4)
prod2=$(“$dir_cprog”/dec_proc $angle 1 10)
#tan 60
prod1=$(“$dir_cprog”/dec_proc ${numb[1]} $prod2 3 )
answer=$(“$dir_cprog”/dec_proc $prod1 1 7 )
;;
“28”)
angle=$(“$dir_cprog”/dec_proc $PI 3 4)
prod2=$(“$dir_cprog”/dec_proc $angle 1 10)
#tan 60
prod1=$(“$dir_cprog”/dec_proc ${numb[1]} ${numb[1]} 3 )
answer=$(“$dir_cprog”/dec_proc $prod1 $prod2 4 )
;;
“29”)
half_side=$(“$dir_cprog”/dec_proc ${numb[1]} 6 4)
angle=$(“$dir_cprog”/dec_proc $PI 3 4)
prod2=$(“$dir_cprog”/dec_proc $angle 1 10)
#tan 60
prod1=$(“$dir_cprog”/dec_proc $half_side $half_side 3 )
answer=$(“$dir_cprog”/dec_proc $prod1 $prod2 3 )
;;
“30”)
half_side=$(“$dir_cprog”/dec_proc ${numb[1]} 2 4)
angle=$(“$dir_cprog”/dec_proc $PI 3 4)
prod2=$(“$dir_cprog”/dec_proc $angle 1 10)
#tan 60
prod1=$(“$dir_cprog”/dec_proc $half_side $half_side 3 )
answer=$(“$dir_cprog”/dec_proc $prod1 $prod2 3 )
;;
“31”)
angle=$(“$dir_cprog”/dec_proc $PI 6 4)
prod2=$(“$dir_cprog”/dec_proc $angle 1 10)
#tan 30
prod1=$(“$dir_cprog”/dec_proc ${numb[1]} 6 4 )
prod1=$(“$dir_cprog”/dec_proc $prod1 $prod2 3 )
prod1=$(“$dir_cprog”/dec_proc $prod1 2 3 )
prod1=$(“$dir_cprog”/dec_proc $prod1 $prod1 3 )
prod1=$(“$dir_cprog”/dec_proc $prod1 1 7 )
prod1=$(“$dir_cprog”/dec_proc $prod1 4 3 )
answer=$prod1
;;
“32”)
angle=$(“$dir_cprog”/dec_proc $PI 6 4)
prod2=$(“$dir_cprog”/dec_proc $angle 1 10)
#tan 30
prod1=$(“$dir_cprog”/dec_proc ${numb[1]} 6 4 )
prod1=$(“$dir_cprog”/dec_proc $prod1 $prod2 3 )
prod1=$(“$dir_cprog”/dec_proc $prod1 2 3 )
prod1=$(“$dir_cprog”/dec_proc $prod1 $prod1 3 )
prod1=$(“$dir_cprog”/dec_proc $prod1 1 7 )
prod1=$(“$dir_cprog”/dec_proc $prod1 $prod1 3 )
answer=$prod1
;;
“33”)
angle=$(“$dir_cprog”/dec_proc $PI 6 4)
prod2=$(“$dir_cprog”/dec_proc $angle 1 10)
#tan 30
prod1=$(“$dir_cprog”/dec_proc ${numb[1]} 6 4 )
prod1=$(“$dir_cprog”/dec_proc $prod1 $prod2 3 )
prod1=$(“$dir_cprog”/dec_proc $prod1 2 3 )
prod1=$(“$dir_cprog”/dec_proc $prod1 $prod1 3 )
prod1=$(“$dir_cprog”/dec_proc $prod1 1 7 )
answer=$prod1
;;
“34”)
#   r=get radius of circle around triangle of perimeter x
angle=$(“$dir_cprog”/dec_proc $PI 6 4)
prod2=$(“$dir_cprog”/dec_proc $angle 1 8)
#cos 30
prod1=$(“$dir_cprog”/dec_proc ${numb[1]} 6 4)
r=$(“$dir_cprog”/dec_proc $prod1 $prod2 4)
#   get circumference of circle of radius r
prod3=$(“$dir_cprog”/dec_proc $r $PI 3)
ci=$(“$dir_cprog”/dec_proc $prod3 2 3)
#   get perimeter of square around circle of circumference c
prod3=$(“$dir_cprog”/dec_proc $ci $PI 4)
prod3=$(“$dir_cprog”/dec_proc $prod3 4 3)
answer=$prod3
echo “not correct”
;;
“35”)
#   r=get radius of circle around triangle of perimeter x
angle=$(“$dir_cprog”/dec_proc $PI 6 4)
prod2=$(“$dir_cprog”/dec_proc $angle 1 8)
#cos 30
prod1=$(“$dir_cprog”/dec_proc ${numb[1]} 6 4)
r=$(“$dir_cprog”/dec_proc $prod1 $prod2 4)
#   get circumference of circle of radius r
prod3=$(“$dir_cprog”/dec_proc $r $PI 3)
ci=$(“$dir_cprog”/dec_proc $prod3 2 3)
#   get perimeter of square around circle of circumference c
prod3=$(“$dir_cprog”/dec_proc $ci $PI 4)
prod3=$(“$dir_cprog”/dec_proc $prod3 4 3)
answer=$prod3
#   get length of side of square with a perimeter of $prod3
prod3=$(“$dir_cprog”/dec_proc $prod3 4 4)
# get the area of the square with a side of $prod3
prod3=$(“$dir_cprog”/dec_proc $prod3 $prod3 3)
answer=$prod3
echo “not correct”
;;
“36”)
#   r=get radius of circle around triangle of perimeter x
angle=$(“$dir_cprog”/dec_proc $PI 6 4)
prod2=$(“$dir_cprog”/dec_proc $angle 1 8)
#cos 30
prod1=$(“$dir_cprog”/dec_proc ${numb[1]} 6 4)
r=$(“$dir_cprog”/dec_proc $prod1 $prod2 4)
#   get circumference of circle of radius r
prod3=$(“$dir_cprog”/dec_proc $r $PI 3)
ci=$(“$dir_cprog”/dec_proc $prod3 2 3)
#   get perimeter of square around circle of circumference c
prod3=$(“$dir_cprog”/dec_proc $ci $PI 4)
prod3=$(“$dir_cprog”/dec_proc $prod3 4 3)
#   get length of side of square with a perimeter of $prod3
prod3=$(“$dir_cprog”/dec_proc $prod3 4 4)
answer=$prod3
echo “not correct”
;;
“37”)
angle=$(“$dir_cprog”/dec_proc $PI 6 4)
prod2=$(“$dir_cprog”/dec_proc $angle 1 10)
#tan 30
prod1=$(“$dir_cprog”/dec_proc ${numb[1]} 6 4 )
prod1=$(“$dir_cprog”/dec_proc $prod1 $prod2 3 )
prod1=$(“$dir_cprog”/dec_proc $prod1 2 3 )
answer=$prod1
;;
“38”)
angle=$(“$dir_cprog”/dec_proc $PI 6 4)
prod2=$(“$dir_cprog”/dec_proc $angle 1 10)
#tan 30
prod1=$(“$dir_cprog”/dec_proc ${numb[1]} 6 4 )
prod1=$(“$dir_cprog”/dec_proc $prod1 $prod2 3 )
answer=$prod1
;;
“39”)
angle=$(“$dir_cprog”/dec_proc $PI 6 4)
prod2=$(“$dir_cprog”/dec_proc $angle 1 10)
#tan 30
prod1=$(“$dir_cprog”/dec_proc ${numb[1]} 6 4 )
prod1=$(“$dir_cprog”/dec_proc $prod1 $prod2 3 )
prod1=$(“$dir_cprog”/dec_proc $prod1 2 3 )
prod1=$(“$dir_cprog”/dec_proc $prod1 $PI 3 )
answer=$prod1
;;
“40”)
angle=$(“$dir_cprog”/dec_proc $PI 6 4)
prod2=$(“$dir_cprog”/dec_proc $angle 1 10)
#tan 30
prod1=$(“$dir_cprog”/dec_proc ${numb[1]} 6 4 )
prod1=$(“$dir_cprog”/dec_proc $prod1 $prod2 3 )
prod1=$(“$dir_cprog”/dec_proc $prod1 $prod1 3 )
answer=$(“$dir_cprog”/dec_proc $prod1 $PI 3 )
;;
“41”)
angle=$(“$dir_cprog”/dec_proc $PI 6 4)
prod2=$(“$dir_cprog”/dec_proc $angle 1 8)
#cos 30
prod1=$(“$dir_cprog”/dec_proc ${numb[1]} 6 4)
prod1=$(“$dir_cprog”/dec_proc $prod1 $prod2 4)

answer=$(“$dir_cprog”/dec_proc $prod1 2 3 )
;;
“42”)
angle=$(“$dir_cprog”/dec_proc $PI 6 4)
prod2=$(“$dir_cprog”/dec_proc $angle 1 8)
#cos 30
prod1=$(“$dir_cprog”/dec_proc ${numb[1]} 6 4)
answer=$(“$dir_cprog”/dec_proc $prod1 $prod2 4)
;;
“43”)
#   r=get radius of circle around triangle of perimeter x
angle=$(“$dir_cprog”/dec_proc $PI 6 4)
prod2=$(“$dir_cprog”/dec_proc $angle 1 8)
#cos 30
prod1=$(“$dir_cprog”/dec_proc ${numb[1]} 6 4)
r=$(“$dir_cprog”/dec_proc $prod1 $prod2 4)
#   get circumference of circle of radius r
prod3=$(“$dir_cprog”/dec_proc $r $PI 3)
answer=$(“$dir_cprog”/dec_proc $prod3 2 3)
;;
“44”)
#   r=get radius of circle around triangle of perimeter x
angle=$(“$dir_cprog”/dec_proc $PI 6 4)
prod2=$(“$dir_cprog”/dec_proc $angle 1 8)
#cos 30
prod1=$(“$dir_cprog”/dec_proc ${numb[1]} 6 4)
r=$(“$dir_cprog”/dec_proc $prod1 $prod2 4)
#   get area of circle of radius r
prod3=$(“$dir_cprog”/dec_proc $r $PI 3)
prod3=$(“$dir_cprog”/dec_proc $prod3 ${numb[1]} 3)
answer=$prod3
;;
“45”)
prod3=$(“$dir_cprog”/dec_proc ${numb[3]} ${numb[1]} 2)
prod4=$(“$dir_cprog”/dec_proc ${numb[4]} ${numb[2]} 2)
slope=$(“$dir_cprog”/dec_proc $prod4 $prod3 4)
int=$(“$dir_cprog”/dec_proc $slope ${numb[1]} 3)
answer=$(“$dir_cprog”/dec_proc ${numb[2]} $int 2)
answer=$(“$dir_cprog”/dec_proc $answer $slope 4)
answer=$(“$dir_cprog”/dec_proc $answer -1 3)
;;
“46”)
prod3=$(“$dir_cprog”/dec_proc ${numb[3]} ${numb[1]} 2)
prod4=$(“$dir_cprog”/dec_proc ${numb[4]} ${numb[2]} 2)
slope=$(“$dir_cprog”/dec_proc $prod4 $prod3 4)
int=$(“$dir_cprog”/dec_proc $slope ${numb[1]} 3)
answer=$(“$dir_cprog”/dec_proc ${numb[2]} $int 2)
;;
“47”)
prod3=$(“$dir_cprog”/dec_proc ${numb[3]} ${numb[1]} 2)
prod4=$(“$dir_cprog”/dec_proc ${numb[4]} ${numb[2]} 2)
answer=$(“$dir_cprog”/dec_proc $prod4 $prod3 4)
;;
“48”)
prod3=$(“$dir_cprog”/dec_proc ${numb[4]} ${numb[2]} 2)
prod4=$(“$dir_cprog”/dec_proc ${numb[5]} ${numb[3]} 2)
slope=$(“$dir_cprog”/dec_proc $prod4 $prod3 4)
int=$(“$dir_cprog”/dec_proc $slope ${numb[2]} 3)
answer=$(“$dir_cprog”/dec_proc $slope ${numb[1]} 3)
answer=$(“$dir_cprog”/dec_proc $answer $int 1)
;;
“49”)
prod3=$(“$dir_cprog”/dec_proc ${numb[4]} ${numb[2]} 2)
prod4=$(“$dir_cprog”/dec_proc ${numb[5]} ${numb[3]} 2)
slope=$(“$dir_cprog”/dec_proc $prod4 $prod3 4)
int=$(“$dir_cprog”/dec_proc $slope ${numb[2]} 3)
if [ “$slope” == “0” ]
then
answer=${numb[2]}
else
answer=$(“$dir_cprog”/dec_proc ${numb[1]} $int 2)
answer=$(“$dir_cprog”/dec_proc $answer $slope 4)
fi
;;
esac
echo “question ” $wpnum:
#echo “$answer”
round_number

right_response=$(echo “$answer” | sed -e “s/\(.*\…\).*/\1/”)
read
}

function solve_for_x {
temp1=$(“$dir_cprog”/dec_proc $rn5c $rn4c 3)
temp1=$(“$dir_cprog”/dec_proc $rn2c $temp1 2)
temp2=$(“$dir_cprog”/dec_proc $rn5c $rn3c 3)
temp2=$(“$dir_cprog”/dec_proc $temp2 $rn1c 2)
temp1=$(“$dir_cprog”/dec_proc $temp1 $temp2 4)
answer=$temp1
round_number
answer=$( echo $answer | sed -e “s/\(.*\…\).*/\1/” )
return
}

function solve_diffsq {
temp1=$(“$dir_cprog”/dec_proc $rn3c $rn1c 2)
temp2=$(“$dir_cprog”/dec_proc $rn2c -1 3)
temp2=$(“$dir_cprog”/dec_proc $rn4c $temp2 2)
temp3=$(“$dir_cprog”/dec_proc $temp2 $temp1 4)
x1=$(“$dir_cprog”/dec_proc $temp3 1 7)
x2=$(“$dir_cprog”/dec_proc $x1 -1 3)
answer=$x1
round_number
x1=$( echo $answer | sed -e “s/\(.*\…\).*/\1/” )
answer=$x2
round_number
x2=$( echo $answer | sed -e “s/\(.*\…\).*/\1/” )
answer=$x1,$x2
return
}

function solve_quadratic {
a=$(“$dir_cprog”/dec_proc $rn1c $rn4c 2)
b=$(“$dir_cprog”/dec_proc $rn2c $rn5 2)
c=$(“$dir_cprog”/dec_proc $rn3c $rn6c 2)
delta2=$(“$dir_cprog”/dec_proc $a $c 3)
delta1=$(“$dir_cprog”/dec_proc $b $b 3)
delta2=$(“$dir_cprog”/dec_proc 4 $delta2 3)
delta=$(“$dir_cprog”/dec_proc $delta1 $delta2 2)
makedeltawhole=$(“$dir_cprog”/dec_proc $delta 10000 3)
makedeltawhole=$(echo $makedeltawhole | sed -e “s/\..*//”)
if [ “$makedeltawhole” -lt 0 ]
then
answer=”imaginary,imaginary”
else
sqrtdelta=$(“$dir_cprog”/dec_proc $delta 1 7)
negb=$(“$dir_cprog”/dec_proc $b -1 3)
x1=$(“$dir_cprog”/dec_proc $negb $sqrtdelta 1)
a2=$(“$dir_cprog”/dec_proc $a $2 3)
x1=$(“$dir_cprog”/dec_proc $x1 $a2 4)
x2=$(“$dir_cprog”/dec_proc $negb $sqrtdelta 2)
x2=$(“$dir_cprog”/dec_proc $x2 $a2 4)
answer=$x1
round_number
x1=$( echo $answer | sed -e “s/\(.*\…\).*/\1/” )
answer=$x2
round_number
x2=$( echo $answer | sed -e “s/\(.*\…\).*/\1/” )
answer=$x1,$x2
fi
return
}

function solve_prex {
b=$(“$dir_cprog”/dec_proc $rn4c $rn2c 2)
c=$(“$dir_cprog”/dec_proc $rn1c $rn3c 2)
answer=$(“$dir_cprog”/dec_proc $b $c 4)
round_number
answer=$( echo $answer | sed -e “s/\(.*\…\).*/\1/” )

return
}

function create_word_problem {
num_var=$( echo “$line” | sed -e “s/^.*VARIABLES: \(.\).*/\1/” )
x=$num_var
# echo $x
while [ “$x” -gt “0” ]
do
grpr=$( echo VAR”$(( $num_var-$x+1 ))” )
var=$( echo “$line” | sed -e “s/^.*$grpr\(.*\)$grpr.*/\1/” )
lowint=$( echo “$var” | sed -e “s/\[\(.*\),\(.*\),\(.*\)\]/\2/” )
highint=$( echo “$var” | sed -e “s/\[\(.*\),\(.*\),\(.*\)\]/\3/” )
vartype=$( echo “$var” | sed -e “s/\[\(.*\),\(.*\),\(.*\)\]/\1/” )

if [ “$vartype” == “FLOAT” ]
then
lowint=$(( 10*$lowint ))
highint=$(( 10*highint ))
var_value=$( “$dir_cprog”/random1 $lowint $highint )
var_value=$( “$dir_cprog”/intdiv2float $var_value 10 )
else
var_value=$( “$dir_cprog”/random1 $lowint $highint )
fi
var_value=$( echo $var_value | sed -e “s/^0//” )
line=$( echo “$line” | sed -e “s/^.* PROB://” )
var_value=$(echo $var_value | sed -e “s/\(.*\…\).*/\1/”)
line=$( echo “$line” | sed -e “s/\(.*\)$grpr.*$grpr\(.*\)/\1 $var_value \2/” )
#     echo  $grpr :  $var, $lowint, $highint, $vartype, $var_value
#       read
x=$(($x-1))
subscript=$(($num_var-$x))
numb[$subscript]=$var_value
done
echo “Please round your answer to 2 decimal places, ”
echo “or if the answer is a person, a cat, or cents, simply truncate the number ”
echo “to the integer part.”
echo
case “$wpnum” in
default)
;;
“01”)
prod3=$(“$dir_cprog”/dec_proc ${numb[2]} 2 3)
answer=$(“$dir_cprog”/dec_proc $( $dir_cprog/dec_proc ${numb[1]} $prod3 3 ) ${numb[3]} 4)
#   echo $answer
;;
“02”)
answer=$(( ${numb[1]}*${numb[2]} ))
#   echo $answer
;;
“03”)
answer=$(“$dir_cprog”/intdiv2float $((${numb[1]}*60)) ${numb[2]} )
#   echo $answer
;;
“04”)
if [ ${numb[1]} -lt 0 ]
then
line=$( echo “$line” | sed -e “s/more/fewer/” | sed -e “s/-//” )
fi
#var1=percentage of aa more in college
#VAR3*VAR2*VAR1+VAR3*VAR2
#VAR2*VAR3*(1+VAR1)
#prod3=percentage of aa in prison
#prod1=percentage of aa more in prison
prod3=$(“$dir_cprog”/intdiv2float 1 ${numb[3]} 4 )
prod1=$(“$dir_cprog”/intdiv2float ${numb[1]} 100 )
sum1=$(“$dir_cprog”/dec_proc 1 $prod1 1)
prod1=$(“$dir_cprog”/dec_proc $prod3 $sum1 3)
prod2=$(“$dir_cprog”/dec_proc $prod1 ${numb[2]} 3)
answer=$( “$dir_cprog”/dec_proc $prod2 1000000 3)
answer=$( echo $answer | sed -e “s/\..*//”)
;;
“06”)
prod3=$(“$dir_cprog”/intdiv2float ${numb[2]} 100 )
answer=$(“$dir_cprog”/dec_proc ${numb[1]} $($dir_cprog/dec_proc 1 $prod3  2) 3 )
#   echo $answer
;;
“07”)
answer=$(“$dir_cprog”/dec_proc  ${numb[2]}  1000  3)
answer=$(“$dir_cprog”/dec_proc $answer 7 4)
answer=$(“$dir_cprog”/dec_proc ${numb[1]} $answer 4 )
#   echo $answer
;;
“08”)
if [ “${numb[1]}” == 0 ]
then
break
fi
count=0
testdiff=-100
answer1=$(“$dir_cprog”/dec_proc  ${numb[1]}  100  4)
answer=$(“$dir_cprog”/dec_proc 1 $answer1 2)
test=$(“$dir_cprog”/dec_proc $answer 10 5)
answer2=$(“$dir_cprog”/dec_proc ${numb[3]} ${numb[2]} 4)
test2=$(“$dir_cprog”/dec_proc $answer2 10 5)
test3=$(“$dir_cprog”/dec_proc $test2 $test 4)
answer=$(“$dir_cprog”/dec_proc $test3 2 3)
answer=$(“$dir_cprog”/dec_proc $answer 1 2)
#   oldanswer=1
#   while [ $testdiff -lt 0 ]
#   do
#     oldanswer=$(“$dir_cprog”/dec_proc $oldanswer $answer 3)
#     answer2=$(“$dir_cprog”/dec_proc ${numb[2]} $oldanswer 3)

#    echo “test=” $test
#     diff=$(“$dir_cprog”/dec_proc ${numb[3]} $answer2 2)
#     echo “diff=” $diff
#=2*log(8.6/13.4,10)/log(1-0.003,10)
#     testdiff=$( echo $diff | sed -e “s/\..*//” )
#     count=$(($count+1))
#   done
#   answer=$( echo $(($count*2)) )
;;
“09”)
#60*var2*60*24*var3*var1/var4
const_time=$((60*60*24))
answer1=$(“$dir_cprog”/dec_proc ${numb[1]} ${numb[2]} 3)
answer1=$(“$dir_cprog”/dec_proc $answer1 ${numb[3]} 3)
answer1=$(“$dir_cprog”/dec_proc $answer1 ${numb[4]} 4)
answer1=$(“$dir_cprog”/dec_proc $const_time $answer1 3)
answer=$(“$dir_cprog”/dec_proc $answer1 1000000 4)
#   echo $answer
;;
“10”)
prod3=$(“$dir_cprog”/intdiv2float ${numb[3]} 100 )
prod3=$(“$dir_cprog”/dec_proc 1 $prod3 4)
prod4=$(“$dir_cprog”/dec_proc $prod3 1 1)
#   echo $prod3, $prod4, ${numb[2]}
answer=$(“$dir_cprog”/dec_proc ${numb[2]} $prod4 3 )
answer=$( echo “$answer” | sed -e “s/\..*//” )
#   echo $answer
;;
“11”)
num_planted=$(( ${numb[2]}*${numb[3]} ))
pounds_planted=$(“$dir_cprog”/dec_proc $num_planted ${numb[4]} 3 )
frac_left=$( “$dir_cprog”/dec_proc 100 ${numb[1]} 2 )
pounds_harv=$(“$dir_cprog”/dec_proc $frac_left $pounds_planted 3 )
pounds_harv=$( “$dir_cprog”/dec_proc $pounds_harv 100 4 )
pounds_per_person_day=$(“$dir_cprog”/dec_proc 50 ${numb[6]} 4 )
people_fed=$(“$dir_cprog”/dec_proc $pounds_harv $pounds_per_person_day 4 )
num_days=$(“$dir_cprog”/dec_proc $people_fed  ${numb[5]} 4 )
answer=$num_days
;;
“12”)
percent_of_year_wo=$(“$dir_cprog”/dec_proc ${numb[4]} 12 4 )
percent_of_year_w=$(“$dir_cprog”/dec_proc 1 $percent_of_year 2 )

frac_of_energy_use_during_summer=$( “$dir_cprog”/dec_proc ${numb[6]} 100 4 )
inv_frac=$( “$dir_cprog”/dec_proc $percent_of_year_w $frac_of_energy_use_during_summer 4 )
sum=$( “$dir_cprog”/dec_proc  $percent_of_year_wo $inv_frac 1 )
summer_rate_gallons_of_gas=$(“$dir_cprog”/dec_proc ${numb[2]} $sum 4 )
trip_miles=$(“$dir_cprog”/dec_proc ${numb[3]} 2 3 )
gall_needed_for_trips=$(“$dir_cprog”/dec_proc $trip_miles ${numb[4]} 4 )
gallons_saved=$( “$dir_cprog”/dec_proc $summer_rate_gallons_of_gas $percent_of_year_wo 3 )
number_of_trips=$(“$dir_cprog”/dec_proc $gallons_saved $gall_needed_for_trips 4 )

answer=$number_of_trips
;;
“13”)
quarters=$(“$dir_cprog”/dec_proc ${numb[1]} 0.25 3 )
dimes=$(“$dir_cprog”/dec_proc ${numb[2]} 0.10 3 )
nickels=$(“$dir_cprog”/dec_proc ${numb[3]} 0.05 3 )
pennies=$(“$dir_cprog”/dec_proc ${numb[4]} 0.01 3 )
sum=$(“$dir_cprog”/dec_proc $quarters $nickels 1 )
sum=$(“$dir_cprog”/dec_proc $sum $dimes 1 )
sum=$(“$dir_cprog”/dec_proc $sum $pennies 1 )
answer=$sum
;;
“14”)
er_decrease=$(“$dir_cprog”/dec_proc ${numb[6]} 100 4 )
er_per_day=$(“$dir_cprog”/dec_proc 1 $er_decrease 2 )
er_per_day=$(“$dir_cprog”/dec_proc ${numb[1]} $er_per_day 3 )
er_per_day=$(“$dir_cprog”/dec_proc $er_per_day 7 4 )

ar_increase=$(“$dir_cprog”/dec_proc ${numb[7]} 100 4 )
ar_per_day=$(“$dir_cprog”/dec_proc 1 $ar_increase 1 )
ar_entering=$(“$dir_cprog”/dec_proc ${numb[3]} 100 4 )
ar_per_day=$(“$dir_cprog”/dec_proc $ar_entering $ar_per_day 3 )
ar_per_day=$(“$dir_cprog”/dec_proc $ar_per_day  ${numb[2]} 3 )

change1=$( “$dir_cprog”/dec_proc ${numb[2]} $ar_per_day 2 )
change1=$( “$dir_cprog”/dec_proc $change1 $er_per_day 2 )
num_cats=$(“$dir_cprog”/dec_proc $change1 ${numb[5]} 3)
num_cats=$(“$dir_cprog”/dec_proc $num_cats ${numb[4]} 1)
answer=$( echo “$num_cats” | sed -e “s/\..*//” )
;;
“15”)
peri_n_inches=$( “$dir_cprog”/dec_proc ${numb[1]} ${numb[3]} 3 )
half_blade=$( “$dir_cprog”/dec_proc ${numb[5]} 2 4)
side_n_inches=$( “$dir_cprog”/dec_proc $peri_n_inches 4 4 )
dspace=$( “$dir_cprog”/dec_proc ${numb[6]} 2 3 )
mowerspace=$( “$dir_cprog”/dec_proc ${numb[5]} 2 3 )
dec1=$( “$dir_cprog”/dec_proc $mowerspace $dspace 1 )
dec1=$( “$dir_cprog”/dec_proc $dec1 2 3 )
side_pass1=$( “$dir_cprog”/dec_proc $side_n_inches $dec1 2 )
peri_pass1=$( “$dir_cprog”/dec_proc $side_pass1 4 3 )
time1=$( “$dir_cprog”/dec_proc ${numb[2]} ${numb[4]} 3 )
rate1=$( “$dir_cprog”/dec_proc $peri_pass1 $time1 4 )
#   echo “1: $peri_pass1 $time1 $rate1”
count_pass=1
totaltime=$time1
peri_pass1_ft=$( “$dir_cprog”/dec_proc $peri_pass1 12 4 )
dec1_ft=$( “$dir_cprog”/dec_proc $dec1 12 4 )
dec1_ft=$( “$dir_cprog”/dec_proc $dec1_ft 4 3 )
#   echo “$count_pass: peri = $peri_pass1_ft change = $dec1_ft rate = $rate1 time= $time1 total_time=$totaltime”
dec1=$( “$dir_cprog”/dec_proc ${numb[7]} 100 4 )
#    echo “Frac=$dec1″
dec1=$( “$dir_cprog”/dec_proc ${numb[5]} $dec1 3 )
#    echo “Decreased blade=$dec1″
dec1=$( “$dir_cprog”/dec_proc $dec1 8 3 )
#   echo “$dec1″
#   read

peri_pass2=$( “$dir_cprog”/dec_proc $peri_pass1 $dec1 2 )
old_peri_pass=$( echo “$peri_pass2” |  sed -e “s/\..*//” )
dec=$dec1
oldrate=$rate1
ratex=$( “$dir_cprog”/dec_proc ${numb[8]} 100 4 )
ratex=$( “$dir_cprog”/dec_proc 1 $ratex 2 )
count_pass=2
peri_pass2_ft=$( “$dir_cprog”/dec_proc $peri_pass2 12 4 )
dec_ft=$( “$dir_cprog”/dec_proc $dec 12 4 )
newrate=$( “$dir_cprog”/dec_proc $oldrate $ratex 3 )
newtime=$( “$dir_cprog”/dec_proc $old_peri_pass $newrate 4 )
totaltime=$( “$dir_cprog”/dec_proc $totaltime $newtime 1)
#   echo “$count_pass: peri = $peri_pass2_ft change = $dec_ft rate = $newrate time= $newtime total_time=$totaltime”
#  read
count_pass=0
while [ “$old_peri_pass” -gt 0 ]
do
count_pass=$(($count_pass + 1))
#   dec=$( “$dir_cprog”/dec_proc $dec1 $count_pass 3 )
old_peri_pass=$( “$dir_cprog”/dec_proc $peri_pass2 $dec 2 )
peri_pass2=$old_peri_pass
old_peri_pass=$( echo “$old_peri_pass” | sed -e “s/\..*//” )
oldrate=$newrate
newrate=$( “$dir_cprog”/dec_proc $oldrate $ratex 3 )
newtime=$( “$dir_cprog”/dec_proc $old_peri_pass $newrate 4 )
totaltime=$( “$dir_cprog”/dec_proc $newtime $totaltime 1)
old_peri_pass_ft=$( “$dir_cprog”/dec_proc $old_peri_pass 12 4 )
dec_ft=$( “$dir_cprog”/dec_proc $dec 12 4 )
pass=$(( $count_pass + 2 ))
#   echo “$pass: peri = $old_peri_pass_ft change = $dec_ft rate = $newrate time= $newtime total_time=$totaltime”
#     read
done
answer=$( “$dir_cprog”/dec_proc $totaltime 60 4)
;;
“16”)
energy_of_big_oven=$( “$dir_cprog”/dec_proc $(( 365*${numb[2]} )) ${numb[1]} 3)
energy_of_big_oven=$( “$dir_cprog”/dec_proc $energy_of_big_oven 1000000 4)

#   echo “number_of_seconds of cooking in big oven=” $energy_of_big_oven
new_energy_of_big=$( “$dir_cprog”/dec_proc $energy_of_big_oven $((${numb[8]}+1)) 4)
new_energy_of_big=$( “$dir_cprog”/dec_proc $new_energy_of_big ${numb[4]} 3)
new_energy_of_big=$( “$dir_cprog”/dec_proc $new_energy_of_big ${numb[3]} 4)

#   echo “number of watts used by big oven in new amount of time” $new_energy_of_big

new_energy_of_toaster=$( “$dir_cprog”/dec_proc $new_energy_of_big ${numb[8]} 3)
percent_time=$( “$dir_cprog”/dec_proc ${numb[6]} 100 4)
new_energy_of_toaster=$( “$dir_cprog”/dec_proc $new_energy_of_toaster $percent_time 3)

#   echo “splitting of energy between big and toaster is” $new_energy_of_big $new_energy_of_toaster
total_new_energy=$( “$dir_cprog”/dec_proc $new_energy_of_toaster $new_energy_of_big 1)
#  echo “the sum of the big and toaster oven energy is:” $total_new_energy

old_energy_of_big=$( “$dir_cprog”/dec_proc $energy_of_big_oven ${numb[4]} 3)
#   echo “the old energy usage was:” $old_energy_of_big

diff_between_old_and_new=$( “$dir_cprog”/dec_proc $old_energy_of_big $total_new_energy 2)
#   echo “the difference between the old and the new energy plan is:” $diff_between_old_and_new

num_sec_heat_per_day=$(( 60*24*30 ))
num_sec_heat_per_day=$( “$dir_cprog”/dec_proc $num_sec_heat_per_day ${numb[7]} 3)
num_sec_heat_per_day=$( “$dir_cprog”/dec_proc $num_sec_heat_per_day 1000000 4)
num_sec_saved=$( “$dir_cprog”/dec_proc $diff_between_old_and_new ${numb[5]} 4)
#   echo “number of seconds of electric heat saved is: ” $num_sec_saved
frac_of_day=$( “$dir_cprog”/dec_proc $num_sec_saved $num_sec_heat_per_day 4)

answer=$( “$dir_cprog”/dec_proc $frac_of_day 24 3)
;;
“17”)
toilet_water_use_per_day=$( “$dir_cprog”/dec_proc ${numb[6]} ${numb[7]} 3)
water_use_per_day=$( “$dir_cprog”/dec_proc ${numb[5]} ${numb[4]} 1)
water_use_per_day=$( “$dir_cprog”/dec_proc $water_use_per_day ${numb[3]} 4)
water_use_per_day=$( “$dir_cprog”/dec_proc $water_use_per_day $toilet_water_use_per_day 1)
num_people=$( “$dir_cprog”/dec_proc 1 ${numb[2]} 1)
water_use_per_day=$( “$dir_cprog”/dec_proc $water_use_per_day $num_people 3)
washing_machine_use_per_day=$( “$dir_cprog”/dec_proc ${numb[8]} ${numb[9]} 3)
water_use_per_day=$( “$dir_cprog”/dec_proc $water_use_per_day $washing_machine_use_per_day 1)
num_days=$( “$dir_cprog”/dec_proc ${numb[1]} $water_use_per_day 4)
answer=$num_days
;;
“18”)
cheese=$( “$dir_cprog”/dec_proc ${numb[3]} ${numb[4]} 3)
squash=$( “$dir_cprog”/dec_proc 1.5 ${numb[6]} 3)
tomatoes=$( “$dir_cprog”/dec_proc 0.7 ${numb[5]} 3)
peppers=$( “$dir_cprog”/dec_proc 0.02 3.99 3)
sum=$( “$dir_cprog”/dec_proc ${numb[1]} ${numb[3]} 1)
sum=$( “$dir_cprog”/dec_proc 0.60 $sum 1)
sum=$( “$dir_cprog”/dec_proc ${numb[7]} $sum 1)
sum=$( “$dir_cprog”/dec_proc ${numb[8]} $sum 1)
sum=$( “$dir_cprog”/dec_proc ${numb[2]} $sum 1)
sum=$( “$dir_cprog”/dec_proc $cheese $sum 1)
sum=$( “$dir_cprog”/dec_proc $squash $sum 1)
sum=$( “$dir_cprog”/dec_proc $tomatoes $sum 1)
sum=$( “$dir_cprog”/dec_proc $peppers $sum 1)
sum=$( “$dir_cprog”/dec_proc $1 $sum 1)
price=$( “$dir_cprog”/dec_proc $sum ${numb[9]} 4)
price=$( “$dir_cprog”/dec_proc $price 100 3)
answer=$( echo “$price” | sed -e “s/\..*//” )
;;
“19”)
sumtolls=$(“$dir_cprog”/dec_proc ${numb[2]} ${numb[4]} 1)
sumtolls=$(“$dir_cprog”/dec_proc ${numb[6]} $sumtolls 1)
summiles=$(“$dir_cprog”/dec_proc ${numb[3]} ${numb[5]} 1)
summiles=$(“$dir_cprog”/dec_proc $summiles ${numb[7]} 1)
frac_dec=$(“$dir_cprog”/dec_proc ${numb[9]} 100 4)
perc_dec=$(“$dir_cprog”/dec_proc 1 $frac_dec 2)
mpgprod=$(“$dir_cprog”/dec_proc ${numb[1]} $perc_dec 3)
numgallons=$(“$dir_cprog”/dec_proc $summiles $mpgprod 4)
price_bypass=$(“$dir_cprog”/dec_proc $numgallons ${numb[8]} 3)
diff_price=$( “$dir_cprog”/dec_proc $sumtolls $price_bypass 2)
answer=$diff_price
;;
“20”)
prod1=$(“$dir_cprog”/dec_proc ${numb[3]} ${numb[1]} 3)
prod2=$(“$dir_cprog”/dec_proc ${numb[1]} ${numb[2]} 3)
diff1=$(“$dir_cprog”/dec_proc 100 ${numb[2]} 2)
diff2=$(“$dir_cprog”/dec_proc $prod1 $prod2 2)
div=$(“$dir_cprog”/dec_proc $diff2 $diff1 4)
answer=$div
;;
esac
check_for_decimals=$(echo “$answer” | sed -e “s/.*\(\.\).*/\1/”)
if [ “$check_for_decimals” == “.” ]
then
round_number
right_response=$(echo “$answer” | sed -e “s/\(.*\…\).*/\1/”)
else
right_response=$answer
fi

read
}

function read_sentence_outloud {
if [ “$read_aloud” == “y” ]
then
repeat=”y”
sp=$( echo $sound_path2/”$random_verb_num”_”$language2″_full_quotes/”$quizfact”_*.* )
echo “directory path is: ” $sp
if [ -e “$sp” ]
then
while [ “$repeat” == “y” ]
do

#< /dev/null &
shighlit=$(grep “^$correctquizfact:” “$language_primer”/$fn*.txt | sed -e “s/^.* SENTCOMP:\(.*\).*/\1/”)
line=$shighlit
#                    trim_line
echo
echo “Press enter when you are ready to hear the sentence read aloud.”
read ready
mplayer -volume 80 “$sp”
if [ $act == “read” ]
then
trim_line
verb_guess=””
asked=$(( $asked + 1 ))

echo “Read the sentences that you heard.  Repeat? (y or n. The default is n.)”
else
verb_guess=””
asked=$(( $asked + 1 ))

echo “Write the sentences that you heard.  Repeat? (y or n. The default is n.)”
fi
read repeat
if [ -e “$repeat” ]
then
repeat=”n”
fi
done
fi
fi
return
}

function show_the_sentence {
l1=$( echo $language1 | sed -e “s/kids-//” )
echo -n “The $l1 noun is: ”
echo_in_color_noun_w_gender  “random quiz line is:” $quizfact
line=$testline
verb_guess=””
asked=$(( $asked + 1 ))
if [ “$act” == “read” ]
then
trim_line

fi
while [ -e $verb_guess ]
do
l2=$( echo $language2 | sed -e “s/kids-queens//” )
echo “Enter the $l2 form of the noun (enter e to exit):”
read verb_guess
done
if [ “$verb_guess” == “e” ]
then
break
fi
echo_verb=$( grep “^$correctquizfact:” “$language_primer”/$fn*.txt | sed -e “s/^[0-9]*c: \(.*\)  ENG: \(.*\) (.) SENT: .*/\1/” )

if [ “$verb_guess” == “$echo_verb” ]
then
echo “Correct.”
right=$(( $right + 1 ))
average=$(( $right/$asked ))
rightverbs=$( echo $rightverbs, $echo_verb)
num_mus=$( $dir_cprog/random1 1 $num_files )
num_mus_fixed=$(echo $num_mus | sed -e “s/^0//”)
prob_time=$(( ${time_array[$num_mus_fixed]} – 20 ))
ssx=($(expr $($dir_cprog/random1 0 $prob_time)))
mplayer -msglevel all=-1 -profile gnome-mplayer -ss $ssx -endpos 20 -volume 200 /mnt/sda1/Documents\ and\ Settings/TEMP/My\ Documents/My\ Music/iTunes/iTunes\ Media/Music/$language1-$language2\ music/$num_mus*.*

else

echo “No.  The correct response is: ”  $echo_verb
echo   “random quiz line is:” $quizfact

wrongverbs=$( echo $wrongverbs, $echo_verb )
fi

echo
return
}

function read_clueword_outloud {
if [ “$read_aloud” == “y” ]
then
repeat=”y”
sp=$( echo $sound_path1/”$random_verb_num”_”$language1″_sound/”$quizfact”_nouns_”*.*” )
echo “directory path is: ” $sp
ls $sp
if [ -e $sp ]
then
while [ “$repeat” == “y” ]
do

#< /dev/null &
#                    shighlit=$(grep “^$correctquizfact:” “$language_primer”/$fn*.txt | sed -e “s/^.* SENTCOMP:\(.*\).*/\1/”)
#                    line=$shighlit
#                    trim_line
#                    echo
#                    echo “Press enter when you are ready to hear the foreign word read aloud.”
#                    read ready
mplayer -volume 80 $sp
#                    trim_line
l1=$( echo $language1 | sed -e “s/kids-//” )
echo “Write on a separate piece of paper, and repeat aloud the $l1 word that you heard.  Repeat? (y or n. The default is n.)”
read repeat
if [ -e “$repeat” ]
then
repeat=”n”
fi
done
echo -n “The word is: ”
echo_in_color_noun_w_gender
echo
echo -n “Did you write it down correctly? (y or n)”
read $mistake
if [ -e “$mistake” ]
then
mistake=0
fi
case “$mistake” in
default)
mistake=0
;;
“y”)
mistake=0
;;
“yes”)
mistake=0
;;
“n”)
mistake=1
;;
“no”)
mistake=1
;;
esac
sum_mistakes=$(( $sum_mistakes + $(( $mistake )) ))
fi
fi
return
}

function read_englishword_outloud {
if [ “$read_aloud” == “y” ]
then
repeat=”y”
sp=$( echo “$sound_path2″/”$random_verb_num”_”$language2″_sound/”$quizfact”_”*.*” )
echo “directory path is: ” $sp
if [ -e $sp ]
then
while [ “$repeat” == “y” ]
do

#< /dev/null &
#                    shighlit=$(grep “^$correctquizfact:” “$language_primer”/$fn*.txt | sed -e “s/^.* SENTCOMP:\(.*\).*/\1/”)
#                    line=$shighlit
#                    trim_line
#                    echo
l1=$( echo $language1 | sed -e “s/kids-//” )
l2=$( echo $language2 | sed -e “s/kids-queens//” )
#                    echo “Press enter when you are ready to hear the $l2 word read aloud.”
#                    read ready
mplayer -volume 80 $sp
#                    trim_line

echo -n “The word in the $l1 language you are studying is: ”
echo_in_color_noun_w_gender
echo

echo “Write on a separate piece of paper and repeat aloud the $l2 word that you heard.  Repeat? (y or n. The default is n.)”
read repeat
if [ -e “$repeat” ]
then
repeat=”n”
fi
done
l1=$( echo $language1 | sed -e “s/kids-//” )
#              echo -n “The word in the $l1 language you are studying is: ”
#              echo_in_color_noun_w_gender
echo
echo -n “The word in $l2 you are studying is: ”
engnoun=$( grep “^$correctquizfact:” “$dir_txt_path2″/$fn*.txt | sed -e “s/^.*c:\(.*\)  ENG:.*/\1/” )
echo $engnoun
echo
echo -n “Did you write it down correctly? (y or n)”
read $mistake
if [ -e “$mistake” ]
then
mistake=0
fi
case “mistake” in
default)
mistake=0
;;
“y”)
mistake=0
;;
“yes”)
mistake=0
;;
“n”)
mistake=1
;;
“no”)
mistake=1
;;
esac
sum_mistakes=$(( $sum_mistakes + $(( $mistake )) ))
fi
fi
return
}

function echo_in_color_noun_w_gender {
case $language in
default)
LANG=es_ES.UTF-8
;;
“german”)
LANG=de_DE.UTF-8
;;
“greek”)
LANG=el_GR.UTF-8
;;
“hebrew”)
LANG=he_IL.UTF-8
revnoun=$( echo $noun | rev_str )
echo “reversed noun ” $revnoun
noun=$revnoun
;;
“norwegian”)
LANG=nn_NO
;;
esac

color=$( grep “^$correctquizfact:” $dir_txt_path1/$fn*.txt | sed -e “s/^[0-9]*c:\(.*\)ENG: \(.*\) *(\(.\)) *SENT:.*/\3/” )
case “$color” in
“m”)
echo -e ‘\E[47;34m'”33[1m$noun33[0m”
;;
“f”)
echo -e ‘\E[47;31m'”33[1m$noun33[0m”
;;
“n”)#0CF82B
echo -e ‘\E[47;42m'”33[1m$noun33[0m”
;;
esac
LANG=es_ES.UTF-8
tput sgr0
return
}
function select_language2 {
lang_picked=”notpicked”
while [ $lang_picked == “notpicked” ]
do
echo “Available reader languages are:”
echo  1. English
echo
echo -n “Enter a number:”
read lang_num
if [ “$lang_num” -gt 6 ]
then
echo “Language not yet available.  Pick another one. ”
fi
case “$lang_num” in
1)
language=”kids-queensenglish”
lang_picked=”picked”
LANG=es_ES.UTF-8
;;
default)
language=”kids-queensenglish”
lang_picked=”picked”
LANG=es_ES.UTF-8
;;
esac
done
language2=$language
l2=$( echo $language2 | sed -e “s/kids-queens//” )
echo “This is a map of where ” $l2 “is spoken in the world.”
viewnior “$dir_path”/maps/”$l2″.png < /dev/null &
return
}

function select_language1 {
lang_picked=”notpicked”
while [ $lang_picked == “notpicked” ]
do
echo “Available exercises are:”
echo  1. Addition
echo  2. Subtraction
echo  3. Multiplication
echo  4. Division
echo  5. Fractions
echo  6. Geometry
echo  7. Polynomials
echo  8. Word Problems
echo  9. Power Problems
echo
echo -n “Enter a number:”
read lang_num
#    if [ “$lang_num” -gt 6 ]
#       then
#         echo “Language not yet available.  Pick another one. ”
#    fi

case “$lang_num” in
1)
language=”addition”
lang_picked=”picked”
;;
2)
language=”subtraction”
lang_picked=”picked”
;;
3)
language=”multiplication”
lang_picked=”picked”
;;
4)
language=”division”
lang_picked=”picked”
;;
5)
language=”fractions”
lang_picked=”picked”
;;
6)
language=”decimals”
lang_picked=”picked”
LANG=es_ES.UTF-8
;;
7)
language=”polynomials”
lang_picked=”picked”
;;
8)
language=”word problems”
lang_picked=”picked”
;;
9)
language=”power problems”
lang_picked=”picked”
;;
default)
language=”addition”
lang_picked=”picked”
;;
esac
language1=$language
#    l1=$( echo $language1 | sed -e “s/kids-//” )
#    echo “This is a map of where ” $l1 “is spoken in the world.”
#    viewnior “$dir_path”/maps/”$l1”.png < /dev/null &
done

return
}

function set_paths {
#clue language is lang1
#reading language is lang2

lang2=$( echo “$language2″testnouns)
tvf2=$( echo “$lang2”)
dir_txt_path2=$( echo “$dir_path”/$tvf2/$lang2 )
tvs2=$( echo “$tvf2″_sound )

lang1=$( echo “$language1”-“$lang2”)
tvf1=$( echo “$lang1”)
dir_txt_path1=$( echo “$dir_path”/$lang2/$tvf1/ )
tvs1=$( echo “$tvf1″_sound )
sound_path1=$( echo “$dir_path”/$tvs2/”$language1″_sound_nouns/ )
sound_path2=$( echo “$dir_path”/$tvs2/”$language2″_sound_nouns/ )

#echo “Clue working language path is: ” $dir_txt_path1
#ls $dir_txt_path1
#echo “Reading working language path is: ” $dir_txt_path2
#ls $dir_txt_path2
#echo “Clue working sound path is: ” $sound_path1
#ls $sound_path1
#echo “Reading working sound path is: ” $sound_path2
#ls $sound_path2

return
}

clear
# select_language2
select_language1
#set_paths

if [ -e “$temp_path/sommaire.out” ]
then
rm “$temp_path/sommaire.out”
fi
#rm $dir_path/hyper-tense-files_used.out
sum_fautes=0
if [ -e “$dir_path” ]
then
echo “directory path passed.”
else
echo “directory path not valid.  Your USB device might be mounted under a different name.  Reset path on line 11 and start over.”
read
fi
echo “Please wait for a few minutes while the system sets up the music database.”
if [ -e “$temp_path/$language-time2.out” ]
then
echo “The program has found a time file.”
echo “1. Use this file.”
echo “2. Make a new time file. Choose 2 if you have changed the music.”
echo “Please choose:  (If you aren’t sure, choose 2.  The default is 2.)”
read choice
else
echo “0” > “$temp_path/$language-time2.out”
choice=2
fi
if [ -e $choice ]
then
choice=2
fi

case $choice in
1)
echo “Using the old file.”
;;
2)
echo “Making another file.  This will take a few minutes.  Please be patient.”
if [ -e “$temp_path/$language-time2.out” ]
then
rm “$temp_path/$language-time2.out”
fi
echo “0” > “$temp_path/$language-time2.out”
mplayer -msglevel all=-1 -profile gnome-mplayer -ss 0 -endpos 1 -volume 0 /mnt/sda1/Documents\ and\ Settings/TEMP/My\ Documents/My\ Music/iTunes/iTunes\ Media/Music/math_music/*.* | tee “$temp_path/temp_file” | grep “^A: ” | sed -e ‘s/^A: .* of \([0-9]*\).* .*/\1/g’ >> “$temp_path/$language-time2.out”
;;
esac

time_array=($(cat “$temp_path/$language-time2.out”))
i=1
num_files=$(expr $(grep -c . “$temp_path/$language-time2.out”))

i=0
while [ $i -lt $num_files ]
do
echo “$i. ${time_array[$i]}”
i=$(( $i + 1 ))
done
num_files=$(( $num_files – 1 ))
echo “num_files=” $num_files
echo
if [ “$lang_num” == “8” -o “$lang_num” == “6” ]
then
if [ “$lang_num” == “8” ]
then
echo “Doing word problems.”
else
echo “Doing geometry problems.”
fi
else
echo “Several options are possible.  Please choose a level (enter a number between 1 and 6).”
echo
echo “Level 1.  0-10 numbers (only positive).”
echo “Level 2.  0-100 numbers (only positive).”
echo “Level 3.  0-1000 numbers (only positive).”
echo “Level 4.  0-10000 numbers (only positive).”
echo “Level 5.  0-10 numbers (positive and negative).”
echo “Level 6.  0-100 numbers (positive and negative).”
echo “Level 7.  0-1000 numbers (positive and negative).”
echo “Level 8.  Numbers with decimals (positive and negative).”
echo
echo -n “Level?”
read choice
#echo  “With oral reading? Choose y or n.  Default is n.”
#read read_aloud
if [ -e $read_aloud ]
then
read_aloud=”n”
fi
flag=”integer”
case “$choice” in
1)
echo “Level 1.”
echo “0-10 numbers”
rnmin=0
rnmax=10
;;
2)
echo “Level 2.”
echo “0-100 numbers”
rnmin=0
rnmax=100
;;
3)
echo “Level 3.”
echo “0-1000 numbers”
rnmin=0
rnmax=1000
;;
4)
echo “Level 4”
echo “0-10000 numbers”
rnmin=0
rnmax=10000
;;
5)
echo “Level 5.”
echo “0 -10 numbers with negatives”
rnmin=-10
rnmax=10
;;
6)
echo “Level 6.”
echo “0-100 numbers with negatives”
rnmin=-100
rnmax=100
;;
7)
echo “Level 7.”
echo “0-1000 numbers with negatives”
rnmin=-1000
rnmax=1000
;;
8)
echo “Level 8.”
echo “Decimals with negatives.”
rnmin=-10000
rnmax=10000
flag=”decimal”
;;
esac
fi

#echo “All information derives from .txt files in the folder ” $dir_txt_path
language_primer=$( echo $dir_txt_path2 )
con=””
right=0
asked=0
rightverbs=””
wrongverbs=””
average=0
verb_guess=””
#num_vfiles=$(expr $(ls -1  $dir_txt_path2/*.txt | grep -c . ))
hours_bgn=$( date| sed “s/.* \(..\):\(..\):\(..\).*/\1/”| sed “s/0\([0-9]\)/\1/” )
min_bgn=$( date| sed “s/.* \(..\):\(..\):\(..\).*/\2/”| sed “s/0\([0-9]\)/\1/” )
sec_bgn=$( date| sed “s/.* \(..\):\(..\):\(..\).*/\3/”| sed “s/0\([0-9]\)/\1/” )
#num_files=$(expr $(grep -c . “$temp_path/$language-time2.out”))
mistakes=0
while [ -e $con ]
do
exp1=$( “$dir_cprog”/random1 1 4 )
ex1=$( echo $exp1 | sed -e “s/^0//” )
exp2=$( “$dir_cprog”/random1 1 4 )
ex2=$( echo $exp2 | sed -e “s/^0//” )
if [ “$flag” == “integer” ]
then
ex1=0
ex2=0
else
exp1=1
exp2=1
#       echo -n “ex1 is” $ex1 “,”
while [ $ex1 -ge 0 ]
do
exp1=$(( 10 * $exp1 ))
ex1=$(( $ex1 – 1 ))
done
#        echo “exponent 1 is” $exp1
#        echo -n “ex2 is” $ex2 “,”
while [ $ex2 -ge 0 ]
do
exp2=$(( 10 * $exp2 ))
ex2=$(( $ex2 – 1 ))
done
#        echo “exponent 2 is” $exp2
fi
case “$lang_num” in
1)
random_num1=$( “$dir_cprog”/random1 $rnmin $rnmax)
rn1c=$( echo $random_num1 | sed -e “s/^0//” )

random_num2=$( “$dir_cprog”/random1 $rnmin $rnmax )
rn2c=$( echo $random_num2 | sed -e “s/^0//” )

if [ $flag == “integer” ]
then
echo -n “$rn1c + $rn2c =”
read response
right_response=$(( $rn1c + $rn2c ))
else
rn1f=$( “$dir_cprog”/intdiv2float $rn1c $exp1 )
rn2f=$( “$dir_cprog”/intdiv2float $rn2c $exp2 )
echo -n “$rn1f + $rn2f =”
read response
right_response=$( “$dir_cprog”/dec_proc $rn1f $rn2f 1 )
fi
language=”addition”
lang_picked=”picked”
;;
2)
random_num1=$( “$dir_cprog”/random1 $rnmin $rnmax)
rn1c=$( echo $random_num1 | sed -e “s/^0//” )

random_num2=$( “$dir_cprog”/random1 $rnmin $rn1c)
rn2c=$( echo $random_num2 | sed -e “s/^0//” )

if [ $flag == “integer” ]
then
echo -n “$rn1c – $rn2c =”
read response
right_response=$(( $rn1c – $rn2c ))
else
rn1f=$( “$dir_cprog”/intdiv2float $rn1c $exp1 )
rn2f=$( “$dir_cprog”/intdiv2float $rn2c $exp2 )
echo -n “$rn1f – $rn2f =”
read response
right_response=$( “$dir_cprog”/dec_proc $rn1f $rn2f 2 )
fi
language=”subtraction”
lang_picked=”picked”
;;
3)
random_num1=$( “$dir_cprog”/random1 $rnmin $rnmax)
rn1c=$( echo $random_num1 | sed -e “s/^0//” )
random_num2=$( “$dir_cprog”/random1 $rnmin $rnmax)
rn2c=$( echo $random_num2 | sed -e “s/^0//” )
if [ $flag == “integer” ]
then
echo -n “$rn1c x $rn2c =”
read response
right_response=$(( $rn1c * $rn2c ))
else
rn1f=$( “$dir_cprog”/intdiv2float $rn1c $exp1 )
rn2f=$( “$dir_cprog”/intdiv2float $rn2c $exp2 )
echo -n “$rn1f x $rn2f =”
read response
right_response=$( “$dir_cprog”/dec_proc $rn1f $rn2f 3 )
fi
language=”multiplication”
lang_picked=”picked”
;;
4)
random_num1=$( “$dir_cprog”/random1 $rnmin $rnmax)
rn1c=$( echo $random_num1 | sed -e “s/^0//” )
random_num2=$( “$dir_cprog”/random1 1 $rnmax)

rn2c=$( echo $random_num2 | sed -e “s/^0//” )
random_num3=$( “$dir_cprog”/random1 0 $rnmax)
rn3c=$( echo $random_num3 | sed -e “s/^0//” )
rn1c=$(( $rn1c*$rn2c ))
#echo “multiplier is: ” $rn1c “,” $rn2c

if [ $flag == “integer” ]
then
echo -n “$rn1c / $rn2c =”
read response
right_response=$(( $rn1c / $rn2c ))
else
rn1f=$( “$dir_cprog”/intdiv2float $rn1c $exp1 )
rn2f=$( “$dir_cprog”/intdiv2float $rn2c $exp2 )
echo -n “$rn1f / $rn2f =”
read response
right_response=$( “$dir_cprog”/dec_proc $rn1f $rn2f 4 )
fi
language=”division”
lang_picked=”picked”
;;
5)
language=”fractions”
lang_picked=”picked”
language=”fractions”
lang_picked=”picked”
#    while [ “$response” == “” ]
#        do

echo “Enter e to exit.”
random_num1=$( “$dir_cprog”/random_prime 1 $rnmax)
rn1c=$( echo $random_num1 | sed -e “s/^0//” )
random_num2=$random_num1
while [ $random_num2 == $random_num1 ]
do
random_num2=$( “$dir_cprog”/random_prime 1 $rnmax)
done
rn2c=$( echo $random_num2 | sed -e “s/^0//” )
random_num3=$( “$dir_cprog”/random1 1 $rnmax)
rn3c=$( echo $random_num2 | sed -e “s/^0//” )

echo “Reduce the following fraction (ex. 49/7=7/1) : “$(($rn1c*$rn3c))”/”$(($rn2c*$rn3c))
read response

response_rn1c=$( echo $response | sed -e “s/\(.*\)\/.*/\1/”)
response_rn2c=$( echo $response | sed -e “s/.*\/\(.*\)/\1/”)
if [ “$response_rn1c” == “$rn1c” -a “$response_rn2c” = “$rn2c” ]
then
right_response=$response
#         right=$(($right + 1 ))
#num_mus=$( “$dir_cprog”/random1 1 $num_files )
#num_mus_fixed=$(echo $num_mus | sed -e “s/^0//”)
#prob_time=$(( ${time_array[$num_mus_fixed]} – 20 ))
#ssx=($(expr $($dir_cprog/random1 0 $prob_time)))
#mplayer -msglevel all=-1 -profile gnome-mplayer -ss $ssx -endpos 20 -volume 200 /mnt/sda1/Documents\ and\ Settings/TEMP/My\ Documents/My\ Music/iTunes/iTunes\ Media/Music/math_music/$num_mus*.*
#      else
#         mistakes=$(($mistakes + 1 ))
fi
#         asked=$(( $asked + 1 ))
#echo “The right response is: ” “$rn1c” / “$rn2c”
#right_response=$rn1c
#aver_right=$( $dir_cprog/intdiv2float $right $asked | sed -e “s/\([0-9]*\…\).*/\1/” )
#echo $right “/” $asked ” correct.  Batting average:” $aver_right “Mistakes: ” $mistakes
#echo “Please wait while I look for another question… Enter e to exit.”
#echo “pass 1″
#read
#done
;;
6)
language=”geometry”
lang_picked=”picked”
num_lines=$( grep -c “^.*: FORMULA” “$dir_path/geometry_problems” )
con=””
response=””
#    while [ “$response” == “” ]
#        do

echo “Enter e to exit.”
wpnum=$( “$dir_cprog”/random1 1 $num_lines )
wpnc=$( echo “$wpnum”c )
line=$( grep “^$wpnc:” “$dir_path/geometry_problems” )
testline=$( echo “$line” | sed -e “s/^.*\(c\): FORMULA.*/\1/” )
if [ “$testline” == “c” ]
then
create_geometry_problem
trim_line
read response
echo “response is ” $response
fi
;;
7)
language=”a little algebra”
lang_picked=”picked”
random_num_0=$( “$dir_cprog”/random1 1 4)
rn0c=$( echo $random_num_0 | sed -e “s/^0//” )
case “$rn0c” in
1)
random_num1=$( “$dir_cprog”/random1 $rnmin $rnmax)
rn1c=$( echo $random_num1 | sed -e “s/^0//” )
random_num2=$( “$dir_cprog”/random1 $rnmin $rnmax)
rn2c=$( echo $random_num2 | sed -e “s/^0//” )
random_num3=$( “$dir_cprog”/random1 $rnmin $rnmax)
rn3c=$( echo $random_num3 | sed -e “s/^0//” )
random_num4=$random_num1
while [ “$random_num1” == “$random_num4” ]
do
random_num4=$( “$dir_cprog”/random1 $rnmin $rnmax)
done
rn4c=$( echo $random_num4 | sed -e “s/^0//” )
random_num5=$( “$dir_cprog”/random1 $rnmin $rnmax)
rn5c=$( echo $random_num5 | sed -e “s/^0//” )
random_num6=$( “$dir_cprog”/random1 $rnmin $rnmax)
rn6c=$( echo $random_num6 | sed -e “s/^0//” )
echo “Solve for x entering your answer rounded to 2 decimal places as x1,x2 : (enter e to exit).”
echo -e $rn1c”x\x00\xB2 + “$rn2c”x + “$rn3c” = “$rn4c”x\x00\xB2 + “$rn5c”x + “$rn6c
read response
x1=0
x2=0
solve_quadratic
x1=$( echo $answer | sed -e “s/\(.*\),.*/\1/”)
x2=$( echo $answer | sed -e “s/.*,\(.*\)/\1/”)

response_rn1c=$( echo $response | sed -e “s/\(.*\),.*/\1/”)
response_rn2c=$( echo $response | sed -e “s/.*,\(.*\)/\1/”)
if [ “$response_rn1c” == “$x1” -a “$response_rn2c” == “$x2” ]
then
right_response=$answer
#         right=$(($right + 1 ))
#         num_mus=$( “$dir_cprog”/random1 1 $num_files )
#num_mus_fixed=$(echo $num_mus | sed -e “s/^0//”)
#prob_time=$(( ${time_array[$num_mus_fixed]} – 20 ))
#ssx=($(expr $($dir_cprog/random1 0 $prob_time)))
#mplayer -msglevel all=-1 -profile gnome-mplayer -ss $ssx -endpos 20 -volume 200 /mnt/sda1/Documents\ and\ Settings/TEMP/My\ Documents/My\ Music/iTunes/iTunes\ Media/Music/math_music/$num_mus*.*
fi
if [ “$response_rn1c” == “$x2” -a “$response_rn2c” == “$x1” ]
then
right_response=$answer
#           num_mus=$( “$dir_cprog”/random1 1 $num_files )
#           num_mus_fixed=$(echo $num_mus | sed -e “s/^0//”)
#           prob_time=$(( ${time_array[$num_mus_fixed]} – 20 ))
#           ssx=($(expr $($dir_cprog/random1 0 $prob_time)))
#           mplayer -msglevel all=-1 -profile gnome-mplayer -ss $ssx -endpos 20 -volume 200 /mnt/sda1/Documents\ and\ Settings/TEMP/My\ Documents/My\ Music/iTunes/iTunes\ Media/Music/math_music/$num_mus*.*
fi
if [ “$answer” == imaginary,imaginary ]
then
echo “needs imaginary numbers.”
right_response=imaginary,imaginary
else
right_response=$answer
fi
;;
2)
random_num1=$( “$dir_cprog”/random1 $rnmin $rnmax)
rn1c=$( echo $random_num1 | sed -e “s/^0//” )
random_num2=$( “$dir_cprog”/random1 $rnmin $rnmax)
rn2c=$( echo $random_num2 | sed -e “s/^0//” )
random_num3=$random_num1
while [ $random_num3 == $random_num1 ]
do
random_num3=$( “$dir_cprog”/random1 $rnmin $rnmax)
done
rn3c=$( echo $random_num3 | sed -e “s/^0//” )
random_num4=$( “$dir_cprog”/random1 $rnmin $rnmax)
rn4c=$( echo $random_num4 | sed -e “s/^0//” )
echo “Solve for x rounding to 2 decimal places: (enter e to exit).”
echo -e $rn1c”x + “$rn2c = “$rn3c”x + $rn4c
read response
solve_prex
right_response=$answer
;;
3)
random_num1=$( “$dir_cprog”/random1 0 $rnmax)
rn1c=$( echo $random_num1 | sed -e “s/^0//” )
random_num2=$( “$dir_cprog”/random1 0 $rnmax)
rn2c=$( echo $random_num2 | sed -e “s/^0//” )
random_num3=$( “$dir_cprog”/random1 $(($rn1c + 1)) $(($rnmax + 1)))
rn3c=$( echo $random_num3 | sed -e “s/^0//” )
random_num4=$( “$dir_cprog”/random1 0 $rn2c)
rn4c=$( echo $random_num4 | sed -e “s/^0//” )
echo “Solve for x entering your answer rounded to 2 decimal places as x1,x2 : (enter e to exit).”
echo -e $rn1c”x\x00\xB2 + “$rn2c” = “$rn3c”x\x00\xB2 – “$rn4c
read response
solve_diffsq
right_response=$answer
response_rn1c=$( echo $response | sed -e “s/\(.*\),.*/\1/”)
response_rn2c=$( echo $response | sed -e “s/.*,\(.*\)/\1/”)
if [ “$response_rn1c” == “$x1” -a “$response_rn2c” == “$x2” ]
then
right_response=$response
#         right=$(($right + 1 ))
#         num_mus=$( “$dir_cprog”/random1 1 $num_files )
#num_mus_fixed=$(echo $num_mus | sed -e “s/^0//”)
#prob_time=$(( ${time_array[$num_mus_fixed]} – 20 ))
#ssx=($(expr $($dir_cprog/random1 0 $prob_time)))
#mplayer -msglevel all=-1 -profile gnome-mplayer -ss $ssx -endpos 20 -volume 200 /mnt/sda1/Documents\ and\ Settings/TEMP/My\ Documents/My\ Music/iTunes/iTunes\ Media/Music/math_music/$num_mus*.*
fi
if [ “$response_rn1c” == “$x2” -a “$response_rn2c” = “$x1” ]
then
right_response=$response
#           num_mus=$( “$dir_cprog”/random1 1 $num_files )
#           num_mus_fixed=$(echo $num_mus | sed -e “s/^0//”)
#           prob_time=$(( ${time_array[$num_mus_fixed]} – 20 ))
#           ssx=($(expr $($dir_cprog/random1 0 $prob_time)))
#           mplayer -msglevel all=-1 -profile gnome-mplayer -ss $ssx -endpos 20 -volume 200 /mnt/sda1/Documents\ and\ Settings/TEMP/My\ Documents/My\ Music/iTunes/iTunes\ Media/Music/math_music/$num_mus*.*
fi
;;
4)
random_num1=$( “$dir_cprog”/random1 $rnmin $rnmax)
rn1c=$( echo $random_num1 | sed -e “s/^0//” )
random_num2=$( “$dir_cprog”/random1 $rnmin $rnmax)
rn2c=$( echo $random_num2 | sed -e “s/^0//” )

tes=$random_num1

while [ “$tes” == “$random_num1” ]
do
random_num3=$( “$dir_cprog”/random1 $rnmin $rnmax)
rn3c=$( echo $random_num3 | sed -e “s/^0//” )

random_num4=$( “$dir_cprog”/random1 $rnmin $rnmax)
rn4c=$( echo $random_num4 | sed -e “s/^0//” )
random_num5=$( “$dir_cprog”/random1 $rnmin $rnmax)
tes=$random_num3*$random_num5
done
rn5c=$( echo $random_num5 | sed -e “s/^0//” )
echo “Solve for x: (enter e to exit).”
echo -e “(“$rn1c”x + “$rn2c”)/(“$rn3c”x + “$rn4c”)=”$rn5c
read response
solve_for_x
right_response=$answer

;;
esac
;;
8)
language=”word problems”
lang_picked=”picked”
#    a=$( /mnt/sdb1/for_kids/c_progs/intdiv2float 3 365 )
#    echo $a
num_lines=$( grep -c “^.*: FORMULA” “$dir_path/word_problems” )
con=””
response=””
#    while [ “$response” == “” ]
#        do

echo “Enter e to exit.”
wpnum=$( “$dir_cprog”/random1 1 $num_lines )
wpnc=$( echo “$wpnum”c )
line=$( grep “^$wpnc:” “$dir_path/word_problems” )
testline=$( echo “$line” | sed -e “s/^.*\(c\): FORMULA.*/\1/” )
if [ “$testline” == “c” ]
then

create_word_problem
trim_line
read response
echo “response is ” $response
fi
#        done
;;
9)
language=”power problems”
lang_picked=”picked”
random_num_0=$( “$dir_cprog”/random1 1 4)
rn0c=$( echo $random_num_0 | sed -e “s/^0//” )
case “$rn0c” in
1)
#solve a raised to the power b
random_num1=$( “$dir_cprog”/random1 $rnmin $rnmax)
rn1c=$( echo $random_num1 | sed -e “s/^0//” )
random_num2=$( “$dir_cprog”/random1 $rnmin $rnmax)
rn2c=$( echo $random_num2 | sed -e “s/^0//” )
random_num3=$( “$dir_cprog”/random1 $rnmin $rnmax)
rn3c=$( echo $random_num3 | sed -e “s/^0//” )
echo “Solve for x entering your answer in scientific notation rounded to 2 decimal places as x E-y: (enter e to exit).”
echo -e $rn1c”x\x10\xB3″ = $rn3c
read response
;;
2)
#Expand a number that is written in scientific notation
oldrnmin=$rnmin
oldrnmax=$rnmax
rnmin=$( “$dir_cprog”/dec_proc $rnmin 100 3 )
rnmax=$( “$dir_cprog”/dec_proc $rnmax 100 3 )
random_num1=$( “$dir_cprog”/random1  $rnmin $rnmax)
rn1c=$( echo $random_num1 | sed -e “s/^0//” )
rn1c=$( “$dir_cprog”/dec_proc $rn1c 100 4)
answer=$rn1c
round_number
rn1c=$answer
rn1c=$( echo $rn1c | sed -e “s/^\(.*\…\).*/\1/” )
rnmin=$( echo $rnmin | sed -e “s/^\(.*\)\(\..*\)/\1/” )
rnmin=$oldrnmin
rnmax=$oldrnmax
if [ “$rnmin” -lt 0 ]
then
rnmin=-5
fi
random_num2=$( “$dir_cprog”/random1 $rnmin $rnmax)
rn2c=$( echo $random_num2 | sed -e “s/^0//” )
num=$( “$dir_cprog”/dec_proc $rn2c 1 11 )
num=$( “$dir_cprog”/dec_proc $num $rn1c 3 )
num=$( echo $num | sed -e “s/^\(.*\…….\).*/\1/” )
echo
echo “Expand $rn1c E$rn2c into decimal form.”
echo “(ex. 3.46 E-2 = 0.0346): (enter e to exit).”
read response
right_response=$( echo $num)
;;
3)
# Enter the value of the exponent in the simplified form
echo
echo “not yet ready.”
#random_num1=$( “$dir_cprog”/random1 0 $rnmax)
#rn1c=$( echo $random_num1 | sed -e “s/^0//” )
#random_num2=$( “$dir_cprog”/random1 0 $rnmax)
#rn2c=$( echo $random_num2 | sed -e “s/^0//” )
#random_num3=$( “$dir_cprog”/random1 $(($rn1c + 1)) $(($rnmax + 1)))
#rn3c=$( echo $random_num3 | sed -e “s/^0//” )
#random_num4=$( “$dir_cprog”/random1 0 $rn2c)
#rn4c=$( echo $random_num4 | sed -e “s/^0//” )
#echo “Solve for x entering your answer rounded to 2 decimal places as x1,x2 : (enter e to exit).”
#echo -e $rn1c”x\x00\xB3 + “$rn2c” = “$rn3c”x\x00\xB2 – “$rn4c
#read response
#solve_diffsq
right_response=”ignore”
#response_rn1c=$( echo $response | sed -e “s/\(.*\),.*/\1/”)
#response_rn2c=$( echo $response | sed -e “s/.*,\(.*\)/\1/”)
#if [ “$response_rn1c” == “$x1” -a “$response_rn2c” == “$x2” ]
#then
#right_response=$response
#fi
#if [ “$response_rn1c” == “$x2” -a “$response_rn2c” = “$x1” ]
#then
#right_response=$response
#fi
;;
4)
#Expand a number that is written in scientific notation
oldrnmin=$rnmin
oldrnmax=$rnmax
rnmin=$( “$dir_cprog”/dec_proc $rnmin 100 3 )
rnmax=$( “$dir_cprog”/dec_proc $rnmax 100 3 )
random_num1=$( “$dir_cprog”/random1  $rnmin $rnmax)
rn1c=$( echo $random_num1 | sed -e “s/^0//” )
rn1c=$( “$dir_cprog”/dec_proc $rn1c 100 4)
answer=$rn1c
round_number
rn1c=$answer
rn1c=$( echo $rn1c | sed -e “s/^\(.*\…\).*/\1/” )
rnmin=$( echo $rnmin | sed -e “s/^\(.*\)\(\..*\)/\1/” )
rnmin=$oldrnmin
rnmax=$oldrnmax
if [ “$rnmin” -lt 0 ]
then
rnmin=-5
fi
random_num2=$( “$dir_cprog”/random1 $rnmin $rnmax)
rn2c=$( echo $random_num2 | sed -e “s/^0//” )
num=$( “$dir_cprog”/dec_proc $rn2c 1 11 )
num=$( “$dir_cprog”/dec_proc $num $rn1c 3 )
num=$( echo $num | sed -e “s/^\(.*\…….\).*/\1/” )
echo
echo “Express $num in scientific notation as $rn1c Ex ”
echo “(ex. 0.0346=3.46 E-2): (enter e to exit).”
read response
right_response=$( echo $rn1c E$rn2c)
;;
esac
;;
default)
language=”addition”
lang_picked=”picked”
;;
esac
if [ “$response” == “e” ]
then
break;
fi
if [ “$response” == “$right_response” ]
then
right=$(($right + 1 ))
num_mus=$( “$dir_cprog”/random1 1 $num_files )
num_mus_fixed=$(echo $num_mus | sed -e “s/^0//”)
prob_time=$(( ${time_array[$num_mus_fixed]} – 20 ))
ssx=($(expr $($dir_cprog/random1 0 $prob_time)))
mplayer -msglevel all=-1 -profile gnome-mplayer -ss $ssx -endpos 20 -volume 200 /mnt/sda1/Documents\ and\ Settings/TEMP/My\ Documents/My\ Music/iTunes/iTunes\ Media/Music/math_music/$num_mus*.*
else
mistakes=$(($mistakes + 1 ))
fi
asked=$(( $asked + 1 ))
echo “The right response is: ” $right_response

aver_right=$( $dir_cprog/intdiv2float $right $asked | sed -e “s/\([0-9]*\…\).*/\1/” )
echo $right “/” $asked ” correct.  Batting average:” $aver_right “Mistakes: ” $mistakes
echo “Please wait while I look for another question… Enter e to exit.”
done
hours_end=$( date| sed “s/.* \(..\):\(..\):\(..\).*/\1/”| sed “s/0\([0-9]\)/\1/” )
min_end=$( date| sed “s/.* \(..\):\(..\):\(..\).*/\2/”| sed “s/0\([0-9]\)/\1/” )
sec_end=$( date| sed “s/.* \(..\):\(..\):\(..\).*/\3/”| sed “s/0\([0-9]\)/\1/” )
hours_diff=$(( $hours_end – $hours_bgn ))
min_diff=$(( $min_end – $min_bgn ))
sec_diff=$(( $sec_end – $sec_bgn ))
midnight=12
if [ $hours_diff -lt 0 ]
then
hours_diff=$(( $(( $midnight – $hours_bgn )) + $hours_end ))
# fix hour change if it happens at midnight or noon,
fi
time_of_ans=$(( $hours_diff * 60 + $min_diff ))
aver_time=$( $dir_cprog/intdiv2float $time_of_ans $((asked – 1)) | sed -e “s/\([0-9]*\…\).*/\1/” )
echo “You worked ” $time_of_ans “minutes for an average of: ” $aver_time “minutes per question, and a sum of ” $(($asked – 1)) “questions with ” $mistakes ” mistakes.” | tee >> $temp_path/sommaire.out
echo “The correct answers (” $right “):” $rightverbs  | tee >>$temp_path/sommaire.out
wrong=$(( $asked -1 – $right ))
echo “The incorrect answers (” $wrong “):” $wrongverbs | tee >>$temp_path/sommaire.out
#num_entries=$(grep “^[0-9]*c:” $dir_txt_path/*.txt | grep -c .)
#echo “The database had ” $num_entries “entries.” | tee >>$temp_path/sommaire.out
echo “Your percentage: ” $aver_right | tee >>$temp_path/sommaire.out
cat $temp_path/sommaire.out

—————————————————————————————————

 

Advertisements
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s