# Khan/khan-exercises

Added second arithmetic word problem type.

1 parent 8280b02 commit e381f26d0cd7758ac4cf8063c0c0bed4e53a514f bradleyt committed May 26, 2011
Showing with 126 additions and 23 deletions.
1. +64 −22 exercises/arithmetic_word_problems.html
2. +1 −1 utils/math.js
3. +61 −0 utils/word-problems.js
 @@ -7,20 +7,27 @@
+ randRange( 3, 12 ) randRange( 1, ITEMS_PER_GROUP - 1 ) randRange( 2, 12 ) GROUPS * ITEMS_PER_GROUP ITEMS_IN_GROUPS + ITEMS_LEFT - getRandomFactor( TOTAL_ITEMS ) + getNontrivialFactor( TOTAL_ITEMS ) TOTAL_ITEMS / NEW_ITEMS_PER_GROUP + + randRange( 4, 12 ) + randRange( 4, 12 ) + randRange( 4, 12 ) + ITEM_1_COUNT * ITEM_1_COST + TOTAL_SPENT_ON_1 + ITEM_2_COST
-
+

person(1) is putting itemPlural(1) into groupPlural(1). @@ -30,34 +37,69 @@ plural( GROUPS, group(1), groupPlural(1) ) and have plural( ITEMS_LEFT, item(1), itemPlural(1) ) left over. If he(1) instead puts - NEW_ITEMS_PER_GROUP itemPlural(1) in each + plural( NEW_ITEMS_PER_GROUP, item(1), itemPlural(1) ) in each group(1), how many groupPlural(1) of itemPlural(1) can he(1) groupVerb(1)?

+

NEW_GROUPS

+ +
+

+ plural( GROUPS, group(1), groupPlural(1) ) of + plural( ITEMS_PER_GROUP, item(1), itemPlural(1) ) each results in + GROUPS \times ITEMS_PER_GROUP = ITEMS_IN_GROUPS + itemPlural(1). +

+ +

+ plural( ITEMS_IN_GROUPS, item(1), itemPlural(1) ) plus + ITEMS_LEFT left over equals + TOTAL_ITEMS total itemPlural(1). +

+ +

+ plural( TOTAL_ITEMS, item(1), itemPlural(1) ) + divided into groups of NEW_ITEMS_PER_GROUP is + TOTAL_ITEMS \div NEW_ITEMS_PER_GROUP = NEW_GROUPS + groupPlural(1). +

+
-
-
-

- plural( GROUPS, group(1), groupPlural(1) ) of - plural( ITEMS_PER_GROUP, item(1), itemPlural(1) ) each results in - GROUPS \times ITEMS_PER_GROUP = ITEMS_IN_GROUPS - itemPlural(1). -

+
+

+ person(1) bought plural(ITEM_1_COUNT, storeItem(1, 1), storeItemPlural(1, 1)), + all costing the same amount, from the store(1) store. He(1) also bought a + storeItem(1, 2) for plural(ITEM_2_COST, "dollar"). He(1) spent a total of + plural(TOTAL_SPENT, "dollar"). How much did each storeItem(1, 1) cost? +

-

- plural( ITEMS_IN_GROUPS, item(1), itemPlural(1) ) plus - ITEMS_LEFT left over equals - TOTAL_ITEMS total itemPlural(1). -

+

ITEM_1_COST

-

- plural( TOTAL_ITEMS, item(1), itemPlural(1) ) - divided into groups of NEW_ITEMS_PER_GROUP is - TOTAL_ITEMS \div NEW_ITEMS_PER_GROUP = NEW_GROUPS - groupPlural(1). - +

+

+ Of the plural(TOTAL_SPENT, "dollar"), he(1) spent + plural(ITEM_2_COST, "dollar") on a storeItem(1, 2), so he(1) must have spent + a total of TOTAL_SPENT - ITEM_2_COST = TOTAL_SPENT_ON_1 + dollars on storeItemPlural(1, 1). +

+ +

+ He(1) spent plural(TOTAL_SPENT_ON_1, "dollar") on + plural(ITEM_1_COUNT, storeItem(1, 1), storeItemPlural(1, 1)), + so he must have spent + TOTAL_SPENT_ON_1 \div ITEM_1_COUNT = ITEM_1_COST + dollars on each storeItem(1, 1). +

+
+
+
+ +
+

+

+

 @@ -145,7 +145,7 @@ jQuery.extend(KhanUtil, { }, // Get a random factor of a composite number which is not 1 or that number - getRandomFactor: function( number ) { + getNontrivialFactor: function( number ) { var factors = this.getFactors( number ); return factors[ this.randRange( 1, factors.length - 2 ) ]; },
 @@ -100,6 +100,51 @@ jQuery.fn[ "word-problemsLoad" ] = function() { ["can of food", "cans of food", "box", "boxes", "fill"] ]); + var stores = KhanUtil.shuffle([ + { + name: "office supply", + items: KhanUtil.shuffle([ + ["pen", "pens"], + ["pencil", "pencils"], + ["notebook", "notebooks"] + ]) + }, + { + name: "hardware", + items: KhanUtil.shuffle([ + ["hammer", "hammers"], + ["nail", "nails"], + ["saw", "saws"] + ]) + }, + { + name: "grocery", + items: KhanUtil.shuffle([ + ["banana", "bananas"], + ["loaf of bread", "loaves of bread"], + ["gallon of milk", "gallons of milk"], + ["potato", "potatoes"] + ]) + }, + { + name: "gift", + items: KhanUtil.shuffle([ + ["toy", "toys"], + ["game", "games"], + ["souvenir", "souvenirs"] + ]) + }, + { + name: "toy", + items: KhanUtil.shuffle([ + ["stuffed animal", "stuffed animals"], + ["video game", "video games"], + ["race car", "race cars"], + ["doll", "dolls"] + ]) + } + ]); + jQuery.extend( KhanUtil, { person: function( i ) { return people[i - 1][0]; @@ -121,6 +166,10 @@ jQuery.fn[ "word-problemsLoad" ] = function() { return people[i - 1][1] == "m" ? "him" : "her"; }, + Him: function( i ) { + return people[i - 1][1] == "m" ? "Him" : "Her"; + }, + his: function( i ) { return people[i - 1][1] == "m" ? "his" : "her"; }, @@ -171,6 +220,18 @@ jQuery.fn[ "word-problemsLoad" ] = function() { groupVerb: function( i ) { return collections[i - 1][4]; + }, + + store: function( i ) { + return stores[i].name; + }, + + storeItem: function( i, j ) { + return stores[i].items[j][0]; + }, + + storeItemPlural: function( i, j ) { + return stores[i].items[j][1]; } }); };