An AI skill that turns books into animated, narrated, interactive web experiences
JavaScript ai-agentsai-educationanimationclaudeclaude-codeclaude-skillsedtecheducationinteractive-textbookscormtext-to-video
feat(math): add gratuity and commission chapter
yzra82fe1c61a67
diff --git a/site/math-notebook/ch22/index.html b/site/math-notebook/ch22/index.htmlindex 92744ea..97c6221 100644--- a/site/math-notebook/ch22/index.html+++ b/site/math-notebook/ch22/index.html@@ -2,7 +2,7 @@<html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Discounts and Markups — Elementary Mathematics</title><link rel="stylesheet" href="../lib/engine.css"><link rel="expect" href="#bar" blocking="render"><style>.band .prompt{font-size:27px}.screen .blanks .bline{gap:12px}.screen .blanks .box{width:8ch!important}.screen .blanks .why{font-size:21px}.screen .blanks .bline svg tspan{font-style:normal}</style></head><body><script src="../lib/engine.js"></script><script src="audio/en/timings.js"></script><script>'use strict';-const CHAPTER={number:22,title:'Discounts and Markups',minutes:9,language:'en'};+const CHAPTER={number:22,title:'Discounts and Markups',minutes:9,language:'en', next: '../ch23/' };// Colours: chalk = original price/cost, coral (nat) = discount, blue = pay / new price, pink (rat) = markup, amber = rate.const DS=COL.nat,TOT=COL.whole,UP=COL.rat;const dsText=(p,s,x,y,t=0,size=30,col=COL.chalk,anchor='start')=>{const e=T(p,s,{x,y,size,fill:col,anchor,o:0});show(e,t);return e;};diff --git a/site/math-notebook/ch23/audio/en/commission.mp3 b/site/math-notebook/ch23/audio/en/commission.mp3new file mode 100644index 0000000..84b05f2Binary files /dev/null and b/site/math-notebook/ch23/audio/en/commission.mp3 differdiff --git a/site/math-notebook/ch23/audio/en/compare.mp3 b/site/math-notebook/ch23/audio/en/compare.mp3new file mode 100644index 0000000..ce342aaBinary files /dev/null and b/site/math-notebook/ch23/audio/en/compare.mp3 differdiff --git a/site/math-notebook/ch23/audio/en/final1.mp3 b/site/math-notebook/ch23/audio/en/final1.mp3new file mode 100644index 0000000..2713ddfBinary files /dev/null and b/site/math-notebook/ch23/audio/en/final1.mp3 differdiff --git a/site/math-notebook/ch23/audio/en/final2.mp3 b/site/math-notebook/ch23/audio/en/final2.mp3new file mode 100644index 0000000..c5900bcBinary files /dev/null and b/site/math-notebook/ch23/audio/en/final2.mp3 differdiff --git a/site/math-notebook/ch23/audio/en/finish.mp3 b/site/math-notebook/ch23/audio/en/finish.mp3new file mode 100644index 0000000..18f2cb0Binary files /dev/null and b/site/math-notebook/ch23/audio/en/finish.mp3 differdiff --git a/site/math-notebook/ch23/audio/en/intro.mp3 b/site/math-notebook/ch23/audio/en/intro.mp3new file mode 100644index 0000000..35ba0a9Binary files /dev/null and b/site/math-notebook/ch23/audio/en/intro.mp3 differdiff --git a/site/math-notebook/ch23/audio/en/prop.mp3 b/site/math-notebook/ch23/audio/en/prop.mp3new file mode 100644index 0000000..b86e3baBinary files /dev/null and b/site/math-notebook/ch23/audio/en/prop.mp3 differdiff --git a/site/math-notebook/ch23/audio/en/proportion.mp3 b/site/math-notebook/ch23/audio/en/proportion.mp3new file mode 100644index 0000000..56d4149Binary files /dev/null and b/site/math-notebook/ch23/audio/en/proportion.mp3 differdiff --git a/site/math-notebook/ch23/audio/en/q1.mp3 b/site/math-notebook/ch23/audio/en/q1.mp3new file mode 100644index 0000000..731d36eBinary files /dev/null and b/site/math-notebook/ch23/audio/en/q1.mp3 differdiff --git a/site/math-notebook/ch23/audio/en/q2.mp3 b/site/math-notebook/ch23/audio/en/q2.mp3new file mode 100644index 0000000..bcdf82dBinary files /dev/null and b/site/math-notebook/ch23/audio/en/q2.mp3 differdiff --git a/site/math-notebook/ch23/audio/en/q3.mp3 b/site/math-notebook/ch23/audio/en/q3.mp3new file mode 100644index 0000000..497895dBinary files /dev/null and b/site/math-notebook/ch23/audio/en/q3.mp3 differdiff --git a/site/math-notebook/ch23/audio/en/timings.js b/site/math-notebook/ch23/audio/en/timings.jsnew file mode 100644index 0000000..14544f7--- /dev/null+++ b/site/math-notebook/ch23/audio/en/timings.js@@ -0,0 +1,411 @@+window.TIMINGS = {+ "intro": {+ "dur": 10.608,+ "marks": {+ "sub": 3.867+ },+ "cues": [+ [+ 0.104,+ "Chapter twenty-three."+ ],+ [+ 1.706,+ "Gratuity and commission."+ ],+ [+ 3.867,+ "Two more ways a percent of a total turns into money: a tip for good service, and a share of what you sell."+ ]+ ]+ },+ "words": {+ "dur": 22.992,+ "marks": {+ "grat": 1.471,+ "com": 8.203,+ "both": 14.141,+ "tax": 19.076,+ "rule": 21.146+ },+ "cues": [+ [+ 0.104,+ "Two new words."+ ],+ [+ 1.471,+ "A gratuity is a tip: a gift of money you give someone for their service, like the server who brings your meal."+ ],+ [+ 8.203,+ "A commission is a fee paid to someone for helping to sell something, like a salesperson at a store."+ ],+ [+ 14.141,+ "In both cases, how much depends on a total: the bill, or the sales."+ ],+ [+ 19.076,+ "So you find it just like sales tax: the rate times the total."+ ]+ ]+ },+ "tip": {+ "dur": 33.36,+ "marks": {+ "bill": 3.112,+ "conv": 6.849,+ "mult": 11.094,+ "tip": 18.529,+ "add": 21.237,+ "one": 29.049+ },+ "cues": [+ [+ 0.091,+ "At the end of a meal, the server brings the bill: twenty-five dollars."+ ],+ [+ 4.753,+ "You want to leave a fifteen percent tip."+ ],+ [+ 6.849,+ "Change fifteen percent to the decimal zero point one five."+ ],+ [+ 11.094,+ "Multiply by the bill: twenty-five times zero point one five is three dollars and seventy-five cents."+ ],+ [+ 18.529,+ "That's the tip, and it goes on top of the bill."+ ],+ [+ 21.237,+ "For the total, add: twenty-five plus three seventy-five is twenty-eight dollars and seventy-five cents."+ ],+ [+ 29.049,+ "Or do it in one step: one point one five times twenty-five."+ ]+ ]+ },+ "prop": {+ "dur": 25.92,+ "marks": {+ "same": 1.628,+ "b20": 4.896,+ "b40": 7.891,+ "b80": 10.352,+ "double": 12.161,+ "line": 14.818,+ "prop": 19.18+ },+ "cues": [+ [+ 0.104,+ "Here's something to notice."+ ],+ [+ 1.628,+ "Keep the tip at fifteen percent, and change the bill."+ ],+ [+ 4.896,+ "A twenty dollar bill gets a three dollar tip."+ ],+ [+ 7.891,+ "Forty dollars gets six dollars."+ ],+ [+ 10.352,+ "Eighty dollars gets twelve."+ ],+ [+ 12.161,+ "Double the bill, and the tip doubles too."+ ],+ [+ 14.818,+ "On a graph, the points sit on one straight line through zero."+ ],+ [+ 19.18,+ "The tip is proportional to the bill."+ ],+ [+ 21.51,+ "Commission works the same way: the more you sell, the more you earn."+ ]+ ]+ },+ "q1": {+ "dur": 5.136,+ "marks": {},+ "cues": [+ [+ 0.104,+ "Quick check."+ ],+ [+ 1.12,+ "Which picture shows a twenty percent tip on a forty dollar bill?"+ ]+ ]+ },+ "commission": {+ "dur": 35.928,+ "marks": {+ "deal": 3.594,+ "sales": 7.552,+ "cut": 15.586,+ "conv": 19.049,+ "mult": 22.266,+ "earn": 27.435,+ "note": 29.87+ },+ "cues": [+ [+ 0.104,+ "My sister got a summer job at her favorite clothing store."+ ],+ [+ 3.594,+ "Her boss pays her a twelve percent commission on her total sales."+ ],+ [+ 7.552,+ "In her first week, she sold three thousand five hundred dollars of clothes."+ ],+ [+ 12.487,+ "That's thirty-five blocks of one hundred dollars."+ ],+ [+ 15.586,+ "Her commission is twelve dollars out of every hundred."+ ],+ [+ 19.049,+ "Twelve percent is zero point one two."+ ],+ [+ 22.266,+ "Three thousand five hundred times zero point one two is four hundred twenty."+ ],+ [+ 27.435,+ "She earned four hundred twenty dollars."+ ],+ [+ 29.87,+ "Notice the difference from a tip: the customer pays no extra."+ ],+ [+ 33.711,+ "The store pays her a share of the sale."+ ]+ ]+ },+ "proportion": {+ "dur": 32.52,+ "marks": {+ "set": 2.904,+ "cross": 7.786,+ "eq": 9.336,+ "prod": 13.451,+ "div": 15.286,+ "x": 17.552,+ "scale": 19.674,+ "same": 28.424+ },+ "cues": [+ [+ 0.104,+ "There's another way to solve it: a proportion."+ ],+ [+ 2.904,+ "Twelve is to one hundred as x is to three thousand five hundred."+ ],+ [+ 7.786,+ "Cross-multiply: one hundred x equals twelve times three thousand five hundred, which is forty-two thousand."+ ],+ [+ 15.286,+ "Divide both sides by one hundred: x is four hundred twenty dollars."+ ],+ [+ 19.674,+ "You can also see it across the table: three thousand five hundred is thirty-five times one hundred, so the commission is thirty-five times twelve."+ ],+ [+ 28.424,+ "The same answer, because a percent is a ratio out of one hundred."+ ]+ ]+ },+ "q2": {+ "dur": 2.376,+ "marks": {},+ "cues": [+ [+ 0.104,+ "Quick check."+ ],+ [+ 1.198,+ "Find the commission."+ ]+ ]+ },+ "compare": {+ "dur": 38.328,+ "marks": {+ "offer": 2.565,+ "sales": 9.036,+ "calc": 13.88,+ "bars": 22.318,+ "pick": 24.206,+ "even": 29.427+ },+ "cues": [+ [+ 0.104,+ "Commission isn't the only way to be paid."+ ],+ [+ 2.565,+ "Amber's boss lets her choose: a twelve percent commission, or a flat fee of five hundred dollars."+ ],+ [+ 9.036,+ "Her total sales for the period are three thousand nine hundred fifty dollars."+ ],+ [+ 13.88,+ "Twelve percent of that is zero point one two times three thousand nine hundred fifty, which is four hundred seventy-four dollars."+ ],+ [+ 22.318,+ "Put the two side by side."+ ],+ [+ 24.206,+ "Four hundred seventy-four is less than five hundred, so she should choose the flat fee."+ ],+ [+ 29.427,+ "Commission would only win if her sales were more than about four thousand one hundred sixty-seven dollars, where twelve percent reaches five hundred."+ ]+ ]+ },+ "q3": {+ "dur": 2.592,+ "marks": {},+ "cues": [+ [+ 0.104,+ "Quick check."+ ],+ [+ 1.198,+ "Who received more money?"+ ]+ ]+ },+ "wrap": {+ "dur": 26.448,+ "marks": {+ "w1": 1.003,+ "w2": 7.409,+ "w3": 11.914,+ "w4": 18.984,+ "end": 24.245+ },+ "cues": [+ [+ 0.104,+ "To sum up."+ ],+ [+ 1.003,+ "A gratuity, or tip, is a percent of the bill."+ ],+ [+ 4.792,+ "A commission is a percent of the sales."+ ],+ [+ 7.409,+ "Change the percent to a decimal, then multiply by the total."+ ],+ [+ 11.914,+ "A tip is added to the bill."+ ],+ [+ 14.089,+ "A commission is a share the seller earns, and the customer pays no extra."+ ],+ [+ 18.984,+ "Or set up a proportion: the rate over one hundred equals the amount over the total."+ ],+ [+ 24.245,+ "Now try the chapter practice."+ ]+ ]+ },+ "final1": {+ "dur": 5.184,+ "marks": {},+ "cues": [+ [+ 0.104,+ "Chapter practice."+ ],+ [+ 1.497,+ "Tips and totals."+ ],+ [+ 2.891,+ "Round money to the nearest cent."+ ]+ ]+ },+ "final2": {+ "dur": 2.568,+ "marks": {},+ "cues": [+ [+ 0.104,+ "Chapter practice."+ ],+ [+ 1.536,+ "Commissions."+ ]+ ]+ },+ "finish": {+ "dur": 3.336,+ "marks": {},+ "cues": [+ [+ 0.104,+ "Well done."+ ],+ [+ 1.042,+ "That's the end of chapter twenty-three."+ ]+ ]+ }+};diff --git a/site/math-notebook/ch23/audio/en/tip.mp3 b/site/math-notebook/ch23/audio/en/tip.mp3new file mode 100644index 0000000..cd339aeBinary files /dev/null and b/site/math-notebook/ch23/audio/en/tip.mp3 differdiff --git a/site/math-notebook/ch23/audio/en/words.mp3 b/site/math-notebook/ch23/audio/en/words.mp3new file mode 100644index 0000000..ef57de4Binary files /dev/null and b/site/math-notebook/ch23/audio/en/words.mp3 differdiff --git a/site/math-notebook/ch23/audio/en/wrap.mp3 b/site/math-notebook/ch23/audio/en/wrap.mp3new file mode 100644index 0000000..8f09f0bBinary files /dev/null and b/site/math-notebook/ch23/audio/en/wrap.mp3 differdiff --git a/site/math-notebook/ch23/index.html b/site/math-notebook/ch23/index.htmlnew file mode 100644index 0000000..1e5065c--- /dev/null+++ b/site/math-notebook/ch23/index.html@@ -0,0 +1,76 @@+<!doctype html>+<html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Gratuity and Commission — Elementary Mathematics</title><link rel="stylesheet" href="../lib/engine.css"><link rel="expect" href="#bar" blocking="render"><style>.band .prompt{font-size:27px}.screen .blanks .bline{gap:12px}.screen .blanks .box{width:8ch!important}.screen .blanks .why{font-size:21px}.screen .blanks .bline svg tspan{font-style:normal}.band .blanks .bline svg tspan{font-style:normal}</style></head><body>+<script src="../lib/engine.js"></script><script src="audio/en/timings.js"></script><script>+'use strict';+const CHAPTER={number:23,title:'Gratuity and Commission',minutes:7,language:'en'};+// Colours: chalk = bill / sales, amber = rate, pink (rat) = tip added on top, blue = total paid, green (irr) = commission.+const TIP=COL.rat,TOT=COL.whole,COM=COL.irr;+const gcText=(p,s,x,y,t=0,size=30,col=COL.chalk,anchor='start')=>{const e=T(p,s,{x,y,size,fill:col,anchor,o:0});show(e,t);return e;};+const gcMath=(p,s,x,y,t=0,size=52,col=COL.chalk,anchor='middle')=>{const e=M(p,Array.isArray(s)?s:[s],{x,y,size,fill:col,anchor,o:0});show(e,t);return e;};+const gcTitle=(p,s,sub='',ts=.15)=>{gcText(p,s,100,110,.1,43);if(sub)gcText(p,sub,100,165,ts,27,COL.dim);};+// bill strip at u px per dollar with the tip (pink) on its right end; tipAt: when the tip grows from nothing (null = drawn already)+function gcBar(p,x,y,u,bill,tip,t=0,h=100,tipAt=null){const g=G(p,{x,y,o:0});const b=mk('rect',{width:bill*u,height:h,fill:COL.chalk,'fill-opacity':.14,stroke:COL.chalk,'stroke-width':3},g);const e=mk('rect',{x:bill*u,width:tip*u,height:h,fill:TIP,'fill-opacity':.7,stroke:TIP,'stroke-width':3},g);if(tipAt!==null){put(e,{a_width:0,o:0});tw(e,{a_width:tip*u,o:1},tipAt,.9,out);}show(g,t);return {g,b,ex:e,w:(bill+tip)*u};}+// sales strip cut into $100 blocks; each block holds a green slice for the rate (0..1) at its foot+function gcSales(p,x,y,u,sales,rate,t=0,h=100,sliceAt=null){const g=G(p,{x,y,o:0}),bw=100*u,n=Math.round(sales/100),sl=[];for(let i=0;i<n;i++)mk('rect',{x:i*bw,width:bw,height:h,fill:COL.chalk,'fill-opacity':.14,stroke:COL.dim,'stroke-width':1.5},g);for(let i=0;i<n;i++){const s=mk('rect',{x:i*bw+1.5,y:h-rate*h,width:bw-3,height:rate*h,fill:COM},g);if(sliceAt!==null){put(s,{o:0});show(s,sliceAt+i*(1.6/n),.3);}sl.push(s);}mk('rect',{width:n*bw,height:h,fill:'none',stroke:COL.chalk,'stroke-width':3},g);show(g,t);return {g,sl,w:n*bw};}+function gcChoices(p,items,u){return items.map(([bill,tip,total],i)=>{const x=130+i*480,g=G(p);gcBar(g,x,360,u,bill,tip,0,100);gcText(g,String.fromCharCode(65+i),x+bill*u/2,270,0,34,COL.dim,'middle');gcText(g,'bill $'+bill,x,330,0,28);gcText(g,'+ tip $'+tip,x,500,0,29,TIP);gcText(g,'= total $'+total,x,550,0,31,TOT);return {el:g,box:[x-20,235,460,360],label:'Picture '+String.fromCharCode(65+i)+', bill '+bill+', tip '+tip+', total '+total};});}+// a paper receipt for the bill, drawn around its top-left corner+function gcReceipt(p,x,y){const g=G(p,{x,y});let d='M0 0H220V300';for(let i=0;i<11;i++)d+=`l-10 ${i%2?14:-14}l-10 ${i%2?-14:14}`;d+='Z';path(g,d,{fill:COL.chalk,'fill-opacity':.1,stroke:COL.chalk,'stroke-width':3});T(g,'BILL',{x:110,y:48,size:26,anchor:'middle',fill:COL.dim,weight:600});[90,130,170].forEach((yy,i)=>{path(g,`M28 ${yy}H${120-i*14}`,{stroke:COL.dim,'stroke-width':3});path(g,`M160 ${yy}H192`,{stroke:COL.dim,'stroke-width':3});});path(g,'M28 205H192',{stroke:COL.chalk,'stroke-width':2,'stroke-dasharray':'6 6'});T(g,'$25.00',{x:110,y:250,size:36,anchor:'middle',font:MATH});return g;}+// a price tag for the sales+function gcTag(p,x,y){const g=G(p,{x,y});path(g,'M0 80L50 0H250V160H50Z',{fill:COL.chalk,'fill-opacity':.1,stroke:COL.chalk,'stroke-width':3});mk('circle',{cx:40,cy:80,r:11,fill:'none',stroke:COL.chalk,'stroke-width':3},g);path(g,'M29 80C-10 60 -20 20 10 -10',{stroke:COL.dim,'stroke-width':2.5});T(g,'SOLD',{x:150,y:62,size:26,anchor:'middle',fill:COL.dim,weight:600});T(g,'$3,500',{x:150,y:118,size:40,anchor:'middle',font:MATH});return g;}+const BEATS=[+['intro','Gratuity and Commission',(m,D)=>{const g=G(scene,{o:0,y:24});T(g,'Unit 2 · Ratios, Proportions, and Percents · Chapter 23',{x:800,y:195,size:28,fill:COL.dim,anchor:'middle'});T(g,'Gratuity and Commission',{x:800,y:390,size:90,weight:600,anchor:'middle'});T(g,'amount = rate × total',{x:800,y:560,size:50,fill:COL.task,anchor:'middle'});tw(g,{o:1,y:0},.2,1,out);gcText(g,'A tip for service · a share of what you sell',800,720,m('sub'),35,COL.dim,'middle');hide(g,D-.8,.7);}],+['words','Two new words',m=>{const p=panel(0);gcTitle(p,'Two new words','Both are a percent of a total');+const L=G(p,{o:0});gcReceipt(L,180,240);T(L,'Gratuity',{x:460,y:300,size:50,weight:600,fill:TIP});T(L,'a tip, given for service',{x:460,y:360,size:30});const lb=T(L,'a percent of the bill',{x:460,y:410,size:29,fill:COL.dim});show(L,m('grat'));+const R=G(p,{o:0});gcTag(R,870,300);T(R,'Commission',{x:1180,y:300,size:50,weight:600,fill:COM});T(R,'a fee for selling',{x:1180,y:360,size:30});const rb=T(R,'a percent of the sales',{x:1180,y:410,size:29,fill:COL.dim});show(R,m('com'));+tw(lb,{c_fill:COL.task},m('both'),.5);tw(rb,{c_fill:COL.task},m('both',1.6),.5);+gcText(p,'found just like sales tax (Chapter 21)',800,660,m('tax'),32,COL.dim,'middle');gcText(p,'amount = rate × total',800,760,m('rule'),58,COL.task,'middle');}],+['tip','A 15% tip',m=>{const p=panel(0);gcTitle(p,'A $25 dinner bill · 15% tip','The tip is 15% of the bill, added on top');const b=gcBar(p,160,250,32,25,3.75,m('bill'),100,m('tip'));gcText(p,'bill $25',560,312,m('bill'),34,COL.chalk,'middle');gcText(p,'tip $3.75',1020,230,m('tip',.3),32,TIP,'middle');+const br=path(p,'M160 372V390H1080V372',{stroke:TOT,'stroke-width':4},{d:0});draw(br,m('add'),.8);gcText(p,'total $28.75',620,436,m('add',.4),36,TOT,'middle');+gcMath(p,'15% = 0.15',800,540,m('conv'),50,COL.task);gcMath(p,'25 × 0.15 = 3.75',800,640,m('mult'),54,TIP);gcMath(p,'25 + 3.75 = 28.75',800,740,m('add'),54,TOT);gcText(p,'one step: 1.15 × 25 = 28.75',800,830,m('one'),34,COL.dim,'middle');}],+['prop','Bigger bill, bigger tip',m=>{const p=panel(0);gcTitle(p,'Same 15% tip · different bills','Each strip: 8 px = $1');+[[20,3,'b20'],[40,6,'b40'],[80,12,'b80']].forEach(([bill,tip,k],i)=>{const y=270+i*150,g=G(p,{o:0});gcBar(g,120,y,8,bill,tip,0,60);T(g,'bill $'+bill,{x:120,y:y-16,size:28});T(g,'tip $'+tip,{x:120+bill*8+8,y:y-16,size:28,fill:TIP});show(g,m(k));if(i)pulse(g,m('double',.2+i*.5),1.03);});+// tip-vs-bill graph: origin (1040,720), 4.6 px per bill dollar, 26 px per tip dollar+const ox=1040,oy=720,gx=v=>ox+v*4.6,gy=v=>oy-v*26,A=G(p,{o:0});path(A,`M${ox} ${gy(16)}V${oy}H${gx(104)}`,{stroke:COL.dim,'stroke-width':3});[20,40,60,80,100].forEach(v=>{path(A,`M${gx(v)} ${oy}v10`,{stroke:COL.dim,'stroke-width':2});T(A,String(v),{x:gx(v),y:oy+38,size:22,fill:COL.dim,anchor:'middle',font:MATH});});[3,6,9,12,15].forEach(v=>{path(A,`M${ox} ${gy(v)}h-10`,{stroke:COL.dim,'stroke-width':2});T(A,String(v),{x:ox-18,y:gy(v)+8,size:22,fill:COL.dim,anchor:'end',font:MATH});});T(A,'bill ($)',{x:gx(104),y:oy+76,size:24,fill:COL.dim,anchor:'end'});T(A,'tip ($)',{x:ox,y:gy(16)-18,size:24,fill:COL.dim,anchor:'middle'});show(A,m('same'));+const ln=path(p,`M${ox} ${oy}L${gx(100)} ${gy(15)}`,{stroke:COL.task,'stroke-width':4},{d:0});draw(ln,m('line'),1.2);+[[20,3,'b20'],[40,6,'b40'],[80,12,'b80']].forEach(([v,w,k])=>{const d=G(p,{x:gx(v),y:gy(w),s:0,o:0});mk('circle',{r:11,fill:TIP},d);pop(d,m(k,.3));});+gcText(p,'double the bill → double the tip',120,760,m('double'),34,COL.task);gcText(p,'tip = 0.15 × bill: the tip is proportional to the bill',800,850,m('prop'),32,COL.chalk,'middle');}],+['q1','Which picture?',()=>{const p=panel(0);gcTitle(p,'A $40 bill · 20% tip','Same scale in each picture: 7 px = $1');S.gcCh=gcChoices(p,[[40,'0.80','40.80'],[40,8,48],[40,20,60]],7);},{ask:done=>quiz(BAND,[{id:'c-tip',prompt:'Which picture shows a 20% tip on the $40 bill?',build:pickEls(S.gcCh,1,'0.20 × 40 = 8, so the tip is $8 and the total is 40 + 8 = $48.',i=>i===0?'$0.80 is 2% of $40. For 20%, multiply by 0.20, not 0.02.':'$20 is half the bill, which is 50%. 20% of $40 is $8.')}],done)}],+['commission','A 12% commission',m=>{const p=panel(0);gcTitle(p,'A summer job · 12% commission on sales','Her first week: $3,500 of clothes sold',m('sales'));const s=gcSales(p,160,250,.24,3500,.12,m('sales'),100,m('cut'));gcText(p,'35 blocks of $100',160,232,m('sales',2),27,COL.dim);+gcText(p,'12% of each block',1040,300,m('cut'),32,COM);gcText(p,'= $12 of every $100',1040,346,m('cut',.6),28,COL.dim);+const bar=mk('rect',{x:160,y:395,width:3500*.12*.24,height:100,fill:COM,'fill-opacity':.75,stroke:COM,'stroke-width':3},p);put(bar,{a_width:0,o:0});tw(bar,{a_width:3500*.12*.24,o:1},m('earn'),.9,out);gcText(p,'her commission: $420',290,458,m('earn',.3),34,COM);+gcMath(p,'12% = 0.12',800,600,m('conv'),50,COL.task);gcMath(p,'3,500 × 0.12 = 420',800,700,m('mult'),54,COM);+gcText(p,'The customer pays $3,500 either way; the store pays her $420 of it.',800,810,m('note'),31,COL.dim,'middle');}],+['proportion','Or use a proportion',m=>{const p=panel(0);gcTitle(p,'Same commission · as a proportion','A percent is a rate out of 100');+gcMath(p,[F('12','100'),' = ',F('x','3,500')],440,330,m('set'),64,COL.chalk);+gcText(p,'cross-multiply',140,450,m('cross'),30,COL.task);gcMath(p,'100x = 12 × 3,500',140,525,m('eq'),48,COL.chalk,'start');gcMath(p,'100x = 42,000',140,615,m('prod'),48,COL.chalk,'start');gcText(p,'÷ 100 on both sides',520,612,m('div'),28,COL.dim);gcMath(p,'x = 420',140,715,m('x'),56,COM,'start');+const tb=G(p,{o:0});T(tb,'sales ($)',{x:1110,y:290,size:28,fill:COL.dim,anchor:'middle'});T(tb,'commission ($)',{x:1340,y:290,size:28,fill:COL.dim,anchor:'middle'});path(tb,'M1000 312H1460M1225 255V520',{stroke:COL.dim,'stroke-width':2});M(tb,['100'],{x:1110,y:395,size:46,anchor:'middle'});M(tb,['12'],{x:1340,y:395,size:46,anchor:'middle'});M(tb,['3,500'],{x:1110,y:495,size:46,anchor:'middle'});const xq=M(tb,['x'],{x:1340,y:495,size:46,anchor:'middle'});show(tb,m('set'));+const x420=gcMath(p,'420',1340,495,m('x'),46,COM);hide(xq,m('x'),.3);+const ar=G(p,{o:0});path(ar,'M990 368Q950 425 990 482M977 468L991 484L998 463',{stroke:COL.task,'stroke-width':3});T(ar,'× 35',{x:950,y:436,size:30,fill:COL.task,anchor:'end'});path(ar,'M1470 368Q1510 425 1470 482M1483 468L1469 484L1462 463',{stroke:COL.task,'stroke-width':3});T(ar,'× 35',{x:1510,y:436,size:30,fill:COL.task});show(ar,m('scale'));pulse(x420,m('scale',4),1.25);+gcText(p,'12 out of 100 is the same rate as 420 out of 3,500',800,830,m('same'),32,COL.chalk,'middle');}],+['q2','Find the commission',()=>{const p=panel(0);gcTitle(p,'$2,400 of furniture sold · 6% commission','Each block = $100; green = 6% of the block');gcSales(p,160,260,.35,2400,.06,0,100);gcText(p,'sales $2,400',160,420,0,30);},{ask:done=>quiz(BAND,[{id:'c-com',prompt:'How much does the salesperson earn?',build:blanks([{parts:['6% of $2,400 = $',{box:'144'}],why:'0.06 × 2,400 = 144: $6 from each of the 24 hundreds.',hint:'Change 6% to 0.06 (not 0.6), then multiply by 2,400.'}])}],done)}],+['compare','Commission or a flat fee?',m=>{const p=panel(0);gcTitle(p,'Amber: 12% commission or a $500 flat fee?','Her sales for the period: $3,950',m('sales'));+gcMath(p,'0.12 × 3,950 = 474',800,270,m('calc'),50,COM);+const x0=440,u=1.3,b1=G(p,{o:0}),b2=G(p,{o:0});mk('rect',{x:x0,y:340,width:474*u,height:70,fill:COM,'fill-opacity':.7,stroke:COM,'stroke-width':3},b1);T(b1,'12% commission',{x:x0-24,y:386,size:30,fill:COM,anchor:'end'});T(b1,'$474',{x:x0+500*u+18,y:388,size:32,fill:COM});+mk('rect',{x:x0,y:450,width:500*u,height:70,fill:COL.chalk,'fill-opacity':.18,stroke:COL.chalk,'stroke-width':3},b2);T(b2,'flat fee',{x:x0-24,y:496,size:30,anchor:'end'});T(b2,'$500',{x:x0+500*u+18,y:498,size:32});show(b1,m('bars'));show(b2,m('bars',.4));+const dl=path(p,`M${x0+500*u} 322V540`,{stroke:COL.task,'stroke-width':3,'stroke-dasharray':'8 8'},{o:0});show(dl,m('pick'));pulse(b2,m('pick',.4),1.03);+gcText(p,'474 < 500 → choose the flat fee',800,625,m('pick'),40,TOT,'middle');+gcMath(p,'500 ÷ 0.12 ≈ 4,166.67',800,725,m('even'),44,COL.task);gcText(p,'Commission pays more only when sales top about $4,166.67.',800,800,m('even',2),30,COL.dim,'middle');}],+['q3','Who received more?',()=>{const p=panel(0);gcTitle(p,'A tip and a commission','Same scale: 2 px = $1');gcText(p,'Luke, a waiter · bill $236 · 18% tip',160,250,0,30,TIP);gcBar(p,160,270,2,236,0,0,70);gcText(p,'Mary, an electronics seller · sales $380 · 12% commission',160,420,0,30,COM);const g=G(p,{x:160,y:440});mk('rect',{width:760,height:70,fill:COL.chalk,'fill-opacity':.14,stroke:COL.chalk,'stroke-width':3},g);},{ask:done=>quiz(BAND,[{id:'c-who',prompt:'Who received more money?',build:choice(['Luke','Mary','They received the same'],1,'Luke: 0.18 × 236 = $42.48. Mary: 0.12 × 380 = $45.60. Mary gets more, even with the smaller rate.',['A bigger rate is not enough: 0.18 × 236 = 42.48, but 0.12 × 380 = 45.60.','','Work out both: 0.18 × 236 = 42.48 and 0.12 × 380 = 45.60.'])}],done)}],+['wrap','Four habits',m=>{const p=panel(0);gcTitle(p,'Gratuity and commission · the same percent idea');[['Gratuity (tip): a percent of the bill. Commission: a percent of the sales.','w1'],['Change the percent to a decimal, then multiply by the total.','w2'],['A tip is added to the bill. A commission is a share of the sale.','w3'],['Or use a proportion: rate / 100 = amount / total.','w4']].forEach(([s,key],i)=>{const g=G(p,{x:-16,y:285+i*145,o:0});mk('circle',{cx:130,cy:-10,r:26,fill:COL.task},g);T(g,String(i+1),{x:130,y:0,size:30,anchor:'middle',fill:COL.board});T(g,s,{x:195,size:31});tw(g,{x:0,o:1},m(key),.6);});}],+['final1','Chapter practice',()=>panel(0),{ask:done=>quiz(SCREEN,[{id:'p-tip',prompt:'Tips and totals. Type only the number of dollars, no $ or commas; round to the cent.',build:blanks([+{parts:['Lee family: $45 bill, 18% tip. Tip $',{box:'8.10'}],why:'0.18 × 45 = 8.10.'},+{parts:['Caterer: $875, 25% tip. Tip $',{box:'218.75'},' total $',{box:'1093.75'}],why:'0.25 × 875 = 218.75, and 875 + 218.75 = 1,093.75.'},+{parts:['Babysitter: $70, 32% tip. Tip $',{box:'22.40'},' total $',{box:'92.40'}],why:'0.32 × 70 = 22.40, and 70 + 22.40 = 92.40.'},+{parts:['Haircut: $25 with a 10% tip. Total $',{box:'27.50'}],why:'1.10 × 25 = 27.50.'},+{parts:['Dinner: $32.75 bill, 17% tip. Total $',{box:'38.32'}],why:'1.17 × 32.75 = 38.3175, which rounds to $38.32.'}+])}],done,'Chapter practice 1 of 2')}],+['final2','Chapter practice',()=>panel(0),{ask:done=>quiz(SCREEN,[{id:'p-com',prompt:'Commissions. Type only the number of dollars, no $ or commas.',build:blanks([+{parts:['35% of $6,000 in sales. Commission $',{box:'2100'}],why:'0.35 × 6,000 = 2,100.'},+{parts:['Julio sells scooters: 8% of $5,450. Commission $',{box:'436'}],why:'0.08 × 5,450 = 436.'},+{parts:['Mauricio: 8% of $25,000 = $',{box:'2000'},' Judith: 9.5% of $22,000 = $',{box:'2090'}],why:'0.08 × 25,000 = 2,000 and 0.095 × 22,000 = 2,090: Judith earned more.'},+{parts:['Agent: 3% of a $250,000 house sale. Commission $',{box:'7500'}],why:'0.03 × 250,000 = 7,500.'}+])}],done,'Chapter practice 2 of 2')}],+['finish','Finished',()=>panel(0),{ask:finishCard}]+].map(([id,title,run,extra])=>({id,title,run,...extra}));+boot();+</script></body></html>diff --git a/site/math-notebook/index.html b/site/math-notebook/index.htmlindex 97e4e31..9531870 100644--- a/site/math-notebook/index.html+++ b/site/math-notebook/index.html@@ -230,7 +230,7 @@ main#contents { padding-bottom: 80px; }// Chapters are numbered in order through the units. Add a chapter here when its lesson is ready.const UNITS = [ // [unit title, [[chapter title, minutes], ...]]; chapters are numbered in order. Add a chapter when its lesson is ready.['The Number System', [['Types of Numbers and the Number Line', 9], ['Positive and Negative Numbers', 8], ['Absolute Value', 9], ['Factors and Greatest Common Factor', 11], ['Multiples and Least Common Multiple', 10], ['Fraction Basics: Types of Fractions and Adding and Subtracting Fractions', 13], ['Multiplying and Dividing Fractions', 12], ['Adding and Subtracting Decimals', 11], ['Multiplying Decimals', 12], ['Dividing Decimals', 10], ['Adding Positive and Negative Numbers', 12], ['Subtracting Positive and Negative Numbers', 13], ['Multiplying and Dividing Positive and Negative Numbers', 14], ['Inequalities', 10]]],- ['Ratios, Proportions, and Percents', [['Ratios', 9], ['Unit Rate and Unit Price', 10], ['Proportions', 12], ['Converting Measurements', 13], ['Percent', 13], ['Percent Word Problems', 13], ['Taxes and Fees', 9], ['Discounts and Markups', 11]]],+ ['Ratios, Proportions, and Percents', [['Ratios', 9], ['Unit Rate and Unit Price', 10], ['Proportions', 12], ['Converting Measurements', 13], ['Percent', 13], ['Percent Word Problems', 13], ['Taxes and Fees', 9], ['Discounts and Markups', 11], ['Gratuity and Commission', 7]]],];const HUES = ['#f4a48c', '#86c9e8', '#f3c95c', '#e8a0c8', '#8fd6b0', '#bba8ee', '#f0b45a'];const id = n => 'ch' + String(n).padStart(2, '0');