User Tools

Site Tools


gibson:teaching:fall-2014:math445:hw4solns

====== Differences ====== This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
gibson:teaching:fall-2014:math445:hw4solns [2014/10/23 07:58]
gibson [Math 445 HW4 solutions]
gibson:teaching:fall-2014:math445:hw4solns [2014/10/23 09:09] (current)
gibson
Line 22: Line 22:
 % return dollar value of q quarters, d dimes, and n nickels % return dollar value of q quarters, d dimes, and n nickels
  
-  if q != round(q) | d != round(d) | n != round(n)+  if q != round(q) ​|| d != round(d) ​|| n != round(n)
     fprintf('​error:​ arguments q,d,n should all have integer values'​);​     fprintf('​error:​ arguments q,d,n should all have integer values'​);​
   dollars = 0.25*q + 0.10*d + 0.05*n;   dollars = 0.25*q + 0.10*d + 0.05*n;
Line 225: Line 225:
   fprintf('​%d %s is equivalent to %d %s\n', Tin, uin, Tout, uout)   fprintf('​%d %s is equivalent to %d %s\n', Tin, uin, Tout, uout)
 end end
 +</​code>​
 +A few non-comprehensive tests:
 +<code matlab>
 +>> T = tempconvert(0)
 +Enter the current units of temperature,​ K, C, or F: C
 +Enter the unit you want to convert to,  K, C, or F: F
 +0 C is equivalent to 32 F
 +T =
 +    32
 +>> T = tempconvert(0)
 +Enter the current units of temperature,​ K, C, or F: K
 +Enter the unit you want to convert to,  K, C, or F: C
 +0 K is equivalent to -2.731500e+02 C
 +T =
 + ​-273.1500
 </​code>​ </​code>​
gibson/teaching/fall-2014/math445/hw4solns.1414076300.txt.gz · Last modified: 2014/10/23 07:58 by gibson