Tuesday 21 April 2015

arithmetic - Setting up a word problem.




I cannot figure out if this is right because there is no example to verify calculations and I have gone over this a few hours now. I do not need help with programming, just the correct mathematics.



"Your kid brother plans to start a lawn-mowing service this summer, and he wants to earn $10 per hour.



The input is (in feet) the length and width of a rectangular yard and the length and width of the house situated in the yard.



All input is in feet. His average speed for mowing is .20 square yards per second. The amount to charge the customer should be printed as output."



Here is what I have:




 MowYardsPerHour = .20 * 60 * 60;
MowRate = 10;

houseLength = houseLength /3;
houseWidth = houseWidth /3;

yardLength = yardLength /3;
yardWidth = yardWidth /3;

squareYdYard = yardLength * yardWidth;

squareYdHouse = houseLength * houseWidth;

mowRange = squareYdYard - squareYdHouse;

amountDue = (mowRange / MowYardsPerHour) * MOW_RATE;


Is this right way to calculate the rate??


Answer



The method is right. I would suggest rewriting the program so that one works purely in feet and square feet. That makes the four conversions to square yards unnecessary.

The mow rate is $(9)(0.2)(60)(60)$ square feet per hour. Let $x$ and $y$ be the overall lot dimensions in feet, and $a$ and $b$ the house dimensions in feet. Then we charge
$$\frac{xy-ab}{(9)(0.2)(3600)}\times 10.$$



Remarks: $1.$ But I am not a good one for business advice. The printout from the longer program may be more impressive.



$2.$ It is good practice to use names for the inputs that are more informative than the ones used in the answer.


No comments:

Post a Comment

real analysis - How to find $lim_{hrightarrow 0}frac{sin(ha)}{h}$

How to find $\lim_{h\rightarrow 0}\frac{\sin(ha)}{h}$ without lhopital rule? I know when I use lhopital I easy get $$ \lim_{h\rightarrow 0}...