Posts Tagged ‘loops’

Farmer Couples Out Shopping

Saturday, January 28th, 2017

In a late autumn afternoon, Jill was sitting under a tree on a campus hill looking despondent,  elbows on her knees and hands holding up her head. Sunlight was fading while yellowish and brown leaves floated erratically down from trees.

Distracted, she did not notice that Jack was approaching from below.

“Hi Jill, you look unhappy,” said Jack. “Want to tell me about it?” He sat nimbly down beside her.

“I think my math professor, Mr. Torquemada, doesn’t like me,” moaned Jill. “He gave me an assignment I have to turn in tomorrow and explain in class, and I can’t figure out head or tails of the problem,” she said shaking her head with a forlorn expression on her face.

“Why don’t you explain the problem to me, maybe I can think of something,” offered Jack with a sympathetic smile, placing his hand lightly on her back.

Jill sighed deeply. “Ok, Jack, here goes:”

“Eight young couples went to the Texas Combo Farm Equipment and Livestock Market to make purchases for the farms they were establishing to form an ecological farming enclave.

The husbands’ names were Henry, Archie, Guiseppe, Pavel, Heinz, Juan, Erik and Shu Wu. The names of their wives were Elfrida, Gunnhilde, Lola, Mary, Teresa, Sally, Jasmine and Lulu.

They all bought the same number of an item as the price of the item in dollars.

It turned out that, respectively, all of the husbands spent 945 dollars more than their wives.

Guiseppe bought 35 more chickens than Lola. Pavel spent 2673 dollars more than Elfrida. Erik bought 95 more pigs than Lulu. Henry spent about one fifth as much as Heinz. Juan bought just about twice as many cows as Sally. Jasmine bought more items than any of the other wives. Mary bought thrice the number of seed bags as Lola. Erik spent about three times as much as Gunnhilde, and relatively a little bit more than Teresa.

 How much did Shu Wu spend, and what was the name of his wife?”

“What a muddle, Jill. What did you do to upset him?”

“Professor Torquemada invited me to a friendly Saturday night dance at his fraternity’s house, where he is a supervisor, and I turned him down, somewhat abruptly I’m afraid,“ explained Jill.

“Oh, I see,” replied Jack, suppressing a laugh.

“Jill, I am taking a course in computer programming and figure that this is an easy problem to solve with a few lines of code,” said Jack encouragingly.

“Please  help me with this, Jack,” pleaded Jill. “I would naturally compensate you somehow,” offering a demure smile.

“Deal,” said Jack. “Come with me. I know a place where we can write some code. I think a double loop will do the job,” he added.

“What’s a double loop?” wondered Jill.

“I’ll show you later.”

Jill jumped up, gathered her books and followed Jack down the hill.


%d bloggers like this: