<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Lettergram</title>
	<atom:link href="http://lettergram.org/feed/" rel="self" type="application/rss+xml" />
	<link>http://lettergram.org</link>
	<description>Imagining is the hard part.</description>
	<lastBuildDate>Sun, 06 May 2012 01:23:00 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Why?</title>
		<link>http://lettergram.org/why/</link>
		<comments>http://lettergram.org/why/#comments</comments>
		<pubDate>Sun, 06 May 2012 01:21:55 +0000</pubDate>
		<dc:creator>Lettergram</dc:creator>
				<category><![CDATA[Social Science]]></category>

		<guid isPermaLink="false">http://lettergram.org/?p=409</guid>
		<description><![CDATA[This poor soul just doesn&#8217;t understand]]></description>
			<content:encoded><![CDATA[<p>This poor soul just doesn&#8217;t understand.</p>
<p><span id="more-409"></span></p>
<p><a href="http://lettergram.org/wp-content/uploads/2012/05/465562_3893086011535_1410571568_3519320_622708295_o.jpg"><img class="alignleft  wp-image-410" title="Man Baby In His Natural Habitat" src="http://lettergram.org/wp-content/uploads/2012/05/465562_3893086011535_1410571568_3519320_622708295_o-1024x768.jpg" alt="" width="491" height="369" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://lettergram.org/why/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Recursion Practice</title>
		<link>http://lettergram.org/397/</link>
		<comments>http://lettergram.org/397/#comments</comments>
		<pubDate>Fri, 20 Apr 2012 05:08:55 +0000</pubDate>
		<dc:creator>Lettergram</dc:creator>
				<category><![CDATA[Code]]></category>

		<guid isPermaLink="false">http://lettergram.org/?p=397</guid>
		<description><![CDATA[Write a recursive function named two_ele_subs with one character string argument. The function will print all of the two-element subsets of a given set of letters. Write a main function with a loop to test the two_ele_subs function with different input character strings. To leave the loop press &#8216;^&#8217; and &#8216;z&#8217; key while holding down ]]></description>
			<content:encoded><![CDATA[<p>Write a recursive function named two_ele_subs with one character string argument. The function will print all of the two-element subsets of a given set of letters. Write a main function with a loop to test the two_ele_subs function with different input character strings.</p>
<p>To leave the loop press &#8216;^&#8217; and &#8216;z&#8217; key while holding down the control key:</p>
<blockquote><p>&#8216;control&#8217; + &#8216;^&#8217; then &#8216;control&#8217; + &#8216;z&#8217;</p></blockquote>
<p><strong> Iterative Version:</strong></p>
<pre class="brush: cpp; title: ; notranslate">
#include &lt;stdio.h&gt;
#include &lt;string.h&gt;

#define max_length 50

void two_ele_subs(char * str){

 int n = strlen(str);
 int i = 0;
 int j = 1;

     while(i &lt; n){
         while(j &lt; n){
            printf(&quot;[%c,%c]\n&quot;, str[i], str[j]);
              ++j;
         }
      ++i;
      j = i + 1;
    }
 printf(&quot;\n\nEnter your string: &quot;);
}

int main(void){

    char str[max_length];

      printf(&quot;Enter your string: &quot;);
    while(scanf(&quot;%s&quot;, &amp;str) != EOF){
      two_ele_subs(str);
    }

system(&quot;pause&quot;);
return 0;
}
</pre>
<p><strong>Recursive Version:</strong></p>
<pre class="brush: cpp; title: ; notranslate">
 #include &lt;stdio.h&gt;
 #include &lt;string.h&gt;

 #define max_length 50

 void two_ele_subs(char * str){

 int n = strlen(str);
 int i = 0;
 int j = 1;
     if(n &gt; 1){
         while(j &lt; n){
             printf(&quot;[%c,%c]\n&quot;, str[i], str[j]);
             ++j;
         }if(i &lt; n){
            ++i;
         }
      two_ele_subs(str+1);
     }
}

int main(void){

char str[max_length];

    printf(&quot;Enter your string: &quot;);
  while(scanf(&quot;%s&quot;, &amp;str) != EOF){
     two_ele_subs(str);
     printf(&quot;\n\nEnter your string: &quot;);
 }

system(&quot;pause&quot;);
return 0;
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://lettergram.org/397/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Bearded Dragon</title>
		<link>http://lettergram.org/bearded-dragon/</link>
		<comments>http://lettergram.org/bearded-dragon/#comments</comments>
		<pubDate>Sun, 08 Apr 2012 14:43:34 +0000</pubDate>
		<dc:creator>Lettergram</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://lettergram.org/?p=387</guid>
		<description><![CDATA[]]></description>
			<content:encoded><![CDATA[<p><a href="http://lettergram.org/wp-content/uploads/2012/04/413460_3123781179395_1410571568_3201326_971943693_o.jpg"><img class="alignleft  wp-image-393" title="Bearded Dragon Car Insurance" src="http://lettergram.org/wp-content/uploads/2012/04/413460_3123781179395_1410571568_3201326_971943693_o-1024x768.jpg" alt="" width="491" height="369" /></a></p>
<p><a href="http://lettergram.org/wp-content/uploads/2012/04/Picture-46.jpg"><img class="alignleft  wp-image-389" title="Picture 46" src="http://lettergram.org/wp-content/uploads/2012/04/Picture-46-1024x768.jpg" alt="" width="491" height="369" /></a></p>
<p><a href="http://lettergram.org/wp-content/uploads/2012/04/Picture-49.jpg"><img class="alignleft  wp-image-390" title="Picture 49" src="http://lettergram.org/wp-content/uploads/2012/04/Picture-49-1024x768.jpg" alt="" width="491" height="369" /></a></p>
<p><a href="http://lettergram.org/wp-content/uploads/2012/04/459462_3710143278081_1410571568_3440931_1362102901_o.jpg"><img class="alignleft size-medium wp-image-388" title="Beardy cage" src="http://lettergram.org/wp-content/uploads/2012/04/459462_3710143278081_1410571568_3440931_1362102901_o-300x225.jpg" alt="" width="300" height="225" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://lettergram.org/bearded-dragon/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Array Practice</title>
		<link>http://lettergram.org/array-practice/</link>
		<comments>http://lettergram.org/array-practice/#comments</comments>
		<pubDate>Fri, 06 Apr 2012 02:38:28 +0000</pubDate>
		<dc:creator>Lettergram</dc:creator>
				<category><![CDATA[Code]]></category>

		<guid isPermaLink="false">http://lettergram.org/?p=380</guid>
		<description><![CDATA[Problem Description: Each year the Department of Traffic Accidents receives accident count reports from a number of cities and towns across the country. To summarize these reports, the department provides a frequency distribution printout that gives the number of cities reporting accident counts in the following ranges: 0 – 99 100 – 199 200 – ]]></description>
			<content:encoded><![CDATA[<h2><span style="text-decoration: underline;">Problem Description:</span></h2>
<p>Each year the Department of Traffic Accidents receives accident count reports from a number of cities and towns across the country. To summarize these reports, the department provides a frequency distribution printout that gives the number of cities reporting accident counts in the following ranges:</p>
<p>0 – 99<br />
100 – 199<br />
200 – 299<br />
300 – 399<br />
400 – 499<br />
500 or above</p>
<p>The department needs a computer program to take the number of accidents for each reporting city or town and add one to the count for the appropriate accident range. After all the data have been processed, the resulting frequency counts are to be displayed.</p>
<p><a href="http://lettergram.org/wp-content/uploads/2012/04/Traffic-Accident-Addition.exe">Traffic Accident Addition</a> (.exe)</p>
<pre class="brush: cpp; title: ; notranslate">

#include &lt;stdio.h&gt;

#define size 6

void updateRange (int *i, int *a_range){
     *i = 0;
   while(*i &gt;= 0){
        printf(&quot;Enter an accident count (negative to end): &quot;);
        scanf(&quot;%d&quot;, &amp;*i);
                if (*i &lt;= 0){
                }else if (*i &lt;= 99){
                   a_range[0]++;
                }else if (*i &lt;= 199){
                   a_range[1]++;
                }else if (*i &lt;= 299){
                   a_range[2]++;
                }else if (*i &lt;= 399){
                   a_range[3]++;
                }else if (*i &lt;= 499){
                   a_range[4]++;
                }else if (*i &gt;= 500){
                   a_range[5]++;
                }
         }
}

void displayRange (int *a_range){
  int y = 0;
  int numRange1 = 0;
  int numRange2 = 99;
    printf(&quot;\n   Range  Frequency\n\n&quot; );
    printf(&quot;%4d-%3d%10d\n &quot;,numRange1, numRange2, a_range[y]);
    ++y;
        while(y &lt; 5){
          numRange1 += 100;
          numRange2 += 100;
            printf(&quot;%d-%d%10d\n &quot;, numRange1, numRange2, a_range[y]);
            ++y;
        }
    numRange1 += 100;
    printf(&quot;%d or above%5d\n\n&quot;,numRange1, a_range[y]);
}

int main(void){
  int i = 0;
  int a_range[size];
      while (i &lt; size){
          a_range[i] = 0;
        ++i;
      }
  updateRange(&amp;i, &amp;*a_range);
  displayRange(&amp;*a_range);
system(&quot;pause&quot;);
return 0;
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://lettergram.org/array-practice/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Four-Leaf Clover Galore</title>
		<link>http://lettergram.org/four-leaf-clover-galore/</link>
		<comments>http://lettergram.org/four-leaf-clover-galore/#comments</comments>
		<pubDate>Thu, 29 Mar 2012 21:30:31 +0000</pubDate>
		<dc:creator>Lettergram</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://lettergram.org/?p=369</guid>
		<description><![CDATA[03/29/2012 03/19/2012 03/19/2012 07/06/2011 ]]></description>
			<content:encoded><![CDATA[<p>03/29/2012</p>
<p><a href="http://lettergram.org/wp-content/uploads/2012/03/412647_3645197214470_1410571568_3410193_582193543_o.jpg"><img class="alignnone  wp-image-370" title="Ten Four-Leaf Clovers" src="http://lettergram.org/wp-content/uploads/2012/03/412647_3645197214470_1410571568_3410193_582193543_o-1024x768.jpg" alt="" width="491" height="369" /></a></p>
<p>03/19/2012</p>
<p><a href="http://lettergram.org/wp-content/uploads/2012/03/478811_3577531362866_1410571568_3379850_934261528_o.jpg"><img class="alignnone  wp-image-371" title="03/19/2012 - Four-Leaf Clover" src="http://lettergram.org/wp-content/uploads/2012/03/478811_3577531362866_1410571568_3379850_934261528_o-1024x768.jpg" alt="" width="491" height="369" /></a></p>
<p>03/19/2012</p>
<p><a href="http://lettergram.org/wp-content/uploads/2012/03/456597_3577370798852_1410571568_3379764_1353855837_o.jpg"><img class="alignnone  wp-image-372" title="ANOTHER - 03/19/2012 - Four-Leaf Clover" src="http://lettergram.org/wp-content/uploads/2012/03/456597_3577370798852_1410571568_3379764_1353855837_o-1024x768.jpg" alt="" width="491" height="369" /></a></p>
<p>07/06/2011</p>
<p><a href="http://lettergram.org/wp-content/uploads/2012/03/280438_2219394530294_1410571568_2579566_701821_o.jpg"><img class="alignnone  wp-image-373" title="07/06/2011 - Four-Leaf Clover" src="http://lettergram.org/wp-content/uploads/2012/03/280438_2219394530294_1410571568_2579566_701821_o-1024x768.jpg" alt="" width="491" height="369" /></a></p>
<p>06/27/2011</p>
<p><a href="http://lettergram.org/wp-content/uploads/2012/03/259153_2195911343229_1410571568_2542886_4583014_o.jpg"><img class="alignnone  wp-image-374" title="06/27/2011 - Four-Leaf Clover" src="http://lettergram.org/wp-content/uploads/2012/03/259153_2195911343229_1410571568_2542886_4583014_o-1024x768.jpg" alt="" width="491" height="369" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://lettergram.org/four-leaf-clover-galore/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>I-D-K</title>
		<link>http://lettergram.org/i-d-k/</link>
		<comments>http://lettergram.org/i-d-k/#comments</comments>
		<pubDate>Thu, 29 Mar 2012 03:15:21 +0000</pubDate>
		<dc:creator>Lettergram</dc:creator>
				<category><![CDATA[Music/Poetry]]></category>

		<guid isPermaLink="false">http://lettergram.org/?p=364</guid>
		<description><![CDATA[Pah, life&#8217;s like the muck, Mighty and fleeting, crushing and seeping. It&#8217;s the life we live, the life we lead, it takes us away, until we scream. It&#8217;s the life of a comedy, dancing in the streets, the mockery of a win, only to be crushed by the &#8220;sin.&#8221; Ha, it&#8217;s only what you bleed]]></description>
			<content:encoded><![CDATA[<p>Pah, life&#8217;s like the muck,<br />
Mighty and fleeting,<br />
crushing and seeping.</p>
<p>It&#8217;s the life we live,<br />
the life we lead,<br />
it takes us away,<br />
until we scream.</p>
<p>It&#8217;s the life of a comedy,<br />
dancing in the streets,<br />
the mockery of a win,<br />
only to be crushed by the &#8220;sin.&#8221;</p>
<p>Ha, it&#8217;s only what you bleed.</p>
]]></content:encoded>
			<wfw:commentRss>http://lettergram.org/i-d-k/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>I am Man</title>
		<link>http://lettergram.org/to-the-living/</link>
		<comments>http://lettergram.org/to-the-living/#comments</comments>
		<pubDate>Wed, 14 Mar 2012 01:24:25 +0000</pubDate>
		<dc:creator>Lettergram</dc:creator>
				<category><![CDATA[Music/Poetry]]></category>

		<guid isPermaLink="false">http://lettergram.org/?p=351</guid>
		<description><![CDATA[It is to those who are, to those true men. It is for you I pledge, for you I avenge. To the world unknowing, to the world I repent. It is to those unyielding, to those who have dreamt. Forever we stare, at the hunks of flesh. Forever we live, in the slobbering mess. It ]]></description>
			<content:encoded><![CDATA[<p>It is to those who are,<br />
to those true men.<br />
It is for you I pledge,<br />
for you I avenge.</p>
<p>To the world unknowing,<br />
to the world I repent.<br />
It is to those unyielding,<br />
to those who have dreamt. </p>
<p>Forever we stare,<br />
at the hunks of flesh.<br />
Forever we live,<br />
in the slobbering mess.</p>
<p>It is for the men,<br />
the man in all,<br />
the givers, the takers;<br />
the human is all.</p>
<p>Greed, HA!<br />
Greed is a sin.<br />
At least,<br />
to the beasts that slobber.</p>
<p>For it is man that is greedy,<br />
and it is man who builds.<br />
It&#8217;s man who yearns,<br />
it is man who has will.</p>
<p>To those who can stand,<br />
to those who can think,<br />
to those with a heart,<br />
to those who aren&#8217;t weak.</p>
<p>To the world I state,<br />
I am greedy.</p>
<p>I love my life,<br />
my blood,<br />
my mornings,<br />
my evening.</p>
<p>I am god,<br />
and believer,<br />
I am the selfish,<br />
the creator, the greedy,<br />
&#8216;nd the savior.</p>
<p>I am the heir to humanity,<br />
the owner who says mine.<br />
Fighting those who beg,<br />
fighting those who only try.</p>
<p>I am an end,<br />
to my end,<br />
not the drooling beast in the room.</p>
<p>the beggars, the sinners,<br />
the meek and the weak;<br />
all swine, taken from womb.</p>
<p>I am god,<br />
the greedy,<br />
the dreamer,<br />
the builder.</p>
<p>I am man.</p>
]]></content:encoded>
			<wfw:commentRss>http://lettergram.org/to-the-living/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Projectile Program (slowly working on)</title>
		<link>http://lettergram.org/347/</link>
		<comments>http://lettergram.org/347/#comments</comments>
		<pubDate>Thu, 08 Mar 2012 05:23:02 +0000</pubDate>
		<dc:creator>Lettergram</dc:creator>
				<category><![CDATA[Code]]></category>

		<guid isPermaLink="false">http://lettergram.org/?p=347</guid>
		<description><![CDATA[]]></description>
			<content:encoded><![CDATA[<pre class="brush: cpp; title: ; notranslate">
/* This program calculates for the standard projectile physics problem in two directions */

#include &lt;stdio.h&gt;
#include &lt;math.h&gt;

#define g -9.81            /* Gravity Constant */
#define rconstant .017453 /* 180/pi or radian conversion constant */

/* All motion in towards ground will have to be negative */

/* Shelved until later - Hang Time */
double t_unkown_hangtime (double *viy, double *yi, double *yf, double *angle, double *t, double *tmax){

     if(((*angle) &lt; 180) &amp;&amp; ((*yf) &gt; (*yi))){
     /* Make sure this works for the proper time... need to do it when awake */
               *tmax = (-((*viy)) - (sqrt((pow((*viy), 2)) - ((2*(g)*(-(*yf) +  (*yi)))))) / (g));
     }else if((*angle &gt; 180) &amp;&amp; ((*yf) &lt; (*yf))){
               *tmax = (-((*viy)) - (sqrt((pow((*viy), 2)) - ((2*(g)*(-(*yf) +  (*yi)))))) / (g));
     }
     return (*tmax);
}

/* Calculate Distance Traveled */
double distance_final_x(double *xi, double *xf, double *yi, double *yf, double *viy, double *vix, double *vfx, double *t){

       double change_in_x;
       double change_in_y;

       if (*yi == 0 &amp;&amp; *yf == 0 &amp;&amp; *t != 9999){
          *xf = (*xi) + ((*vix)*(*t)) + (.5*g)*(pow((*t), 2));
       }else if (*yi == 0 &amp;&amp; *yf == 0 &amp;&amp; *t == 9999){
          change_in_x = (((pow((*vfx), 2)) - (pow((*vix), 2))) / (2*g));
          (*yf) = (change_in_y - (*yi));
       }}

/* Breaks the vi into components */
void components_vi_with_vi (double *vi, double *angle, double *viy, double *vix){
       double radians;
              radians = ((*angle) * (rconstant));
              *viy = ((*vi) * (sin(radians)));
              *vix = ((*vi) * (cos(radians)));
       }          

/* Breaks the vf into components */
void components_vf_with_vf (double *vf, double *angle_impact, double *vfy, double *vfx){
     double radians;
            radians = ((*angle_impact) * (rconstant));
              *vfy = ((*vf) * (sin(radians)));
              *vfx = ((*vf) * (cos(radians)));
      }

int
main (void){

double vi;
double viy;
double vix;
double vf;
double vfy;
double vfx;
double xi;
double xf;
double yi;
double yf ;
double t;
double angle;
double angle_impact;
double tmax;

     printf(&quot;This program should calculate for the unkowns in a  physic projectile problem.\n&quot;);
     printf(&quot;\nThe program is limited to two variable (x and y directions)\n&quot;);
     printf(&quot;and should tell you the max height, hang time, and an unknown\n&quot;);
     printf(&quot;Please enter the data with using the unit circle as your guide. &quot;);

     printf(&quot;\n\nPlease enter the initial velocity: &quot;);
     scanf(&quot;%lf&quot;, &amp;vi);
     printf(&quot;\nPlease enter the angle fired from ground (x-axis) in degrees: &quot;);
     scanf(&quot;%lf&quot;, &amp;angle);
     printf(&quot;\nPlease enter the final velocity (zero if hitting the ground): &quot;);
     scanf(&quot;%lf&quot;, &amp;vf);
     printf(&quot;\nPlease enter the angle of impact from the -x direction: &quot;);
     scanf(&quot;%lf&quot;, &amp;angle_impact);
     printf(&quot;\nPlease enter the inital position in x direction,\n&quot;);
     printf(&quot;(Enter 0 if you have not been told otherwise): &quot;);
     scanf(&quot;%lf&quot;, &amp;xi);
     printf(&quot;\nPlease enter the final position in x direction: &quot;);
     scanf(&quot;%lf&quot;, &amp;xf);
     printf(&quot;\nPlease enter your inital position off the ground (y): &quot;);
     scanf(&quot;%lf&quot;, &amp;yi);
     printf(&quot;\nPlease enter your final position off the ground (y): &quot;);
     scanf(&quot;%lf&quot;, &amp;yf);
     printf(&quot;\nPlease enter time (if time isn't required please type &quot;&quot;9999&quot;&quot; for hang time): &quot;);
     scanf(&quot;%lf&quot;, &amp;t);
     while ((360 &lt;= angle) || (-360 &gt;= angle)){
     printf(&quot;\n FAILURE, PLEASE ENTER AN ANGLE BETWEEN -360 and 360: &quot;);
     scanf(&quot;%lf&quot;, &amp;angle);
     }
     while ((360 &lt;= angle_impact) || (-360 &gt;= angle_impact)){
           printf(&quot;\n FAILURE, PLEASE ENTER AN ANGLE BETWEEN -360 and 360: &quot;);
     scanf(&quot;%lf&quot;, &amp;angle);
     }

          components_vi_with_vi(&amp;vi, &amp;angle, &amp;viy, &amp;vix);

          components_vf_with_vf (&amp;vf, &amp;angle_impact, &amp;vfy, &amp;vfx);

          t_unkown_hangtime (&amp;viy, &amp;yi, &amp;yf, &amp;angle, &amp;t, &amp;tmax);

          distance_final_x (&amp;xi, &amp;xf, &amp;yi, &amp;yf, &amp;viy, &amp;vix, &amp;angle, &amp;t);

     printf(&quot;\nTesting Functions: %.2f \n&quot;, angle_impact);     

 system(&quot;pause&quot;);
return 0;
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://lettergram.org/347/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Programming Problem</title>
		<link>http://lettergram.org/338/</link>
		<comments>http://lettergram.org/338/#comments</comments>
		<pubDate>Sun, 04 Mar 2012 06:51:41 +0000</pubDate>
		<dc:creator>Lettergram</dc:creator>
				<category><![CDATA[Code]]></category>

		<guid isPermaLink="false">http://lettergram.org/?p=338</guid>
		<description><![CDATA[ Found on a website and figured I would whirl! The electric company charges according to the following rate schedule: 9 cents per kilowatt-hour (kwh) for the first 300 kwh 8 cents per kwh for the next 300 kwh (up to 600 kwh) 6 cents per kwh for the next 400 kwh (up to 1,000 kwh) ]]></description>
			<content:encoded><![CDATA[<h3> Found on a website and figured I would whirl!</h3>
<p>The electric company charges according to the following rate schedule:</p>
<p>9 cents per kilowatt-hour (kwh) for the first 300 kwh</p>
<p>8 cents per kwh for the next 300 kwh (up to 600 kwh)</p>
<p>6 cents per kwh for the next 400 kwh (up to 1,000 kwh)</p>
<p>5 cents per kwh for all electricity used over 1,000 kwh.</p>
<p>&nbsp;</p>
<p>Write a function to compute and return the total charge for each customer. Write a main function to call the charge calculation function using the following data:</p>
<p>&nbsp;</p>
<p>Customer Number             Kilowatt-hours used</p>
<p>123                                         725</p>
<p>205                                         115</p>
<p>464                                         600</p>
<p>596                                         327</p>
<p>601                                         915</p>
<p>613                                       1,011</p>
<p>722                                          47</p>
<p>&nbsp;</p>
<p>The program should print a three-column chart listing the customer number, the kilowatt-hours used, and the charge for each customer. The program should also compute and print the number of customers, the total kilowatt-hours used, and the total charges.</p>
<p>&nbsp;</p>
<h2>My Solution:/* Problem Description:</h2>
<p>/* Problem Description:<br />
* The electric company charges according to the following rate schedule:<br />
* 9 cents per kilowatt-hour (kwh) for the first 300 kwh<br />
* 8 cents per kwh for the next 300 kwh (up to 600 kwh)<br />
* 6 cents per kwh for the next 400 kwh (up to 1,000 kwh)<br />
* 5 cents per kwh for all electricity used over 1,000 kwh.<br />
* Write a function to compute and return the total charge for each customer.<br />
*/<br />
#include &lt;stdio.h&gt;<br />
#include &lt;math.h&gt;</p>
<p>#define first .09 /* 9 cents per kwh for first 300 kwh */<br />
#define second .08 /* 8 cents per kwh for next 300 kwh */<br />
#define third .06 /* 6 cents per kwh for next 400 kwh */<br />
#define fourth .05 /* 5 cents per kwh for remaining kwh&#8217;s */</p>
<p>/* Ouput Variables */</p>
<p>double cost;<br />
double total_cost = 0;<br />
int total_customers = 0;<br />
int total_kwh = 0;</p>
<p>/* Cost Calculating (for kwh) */<br />
double charge_calc_kwh (int *kwhp, int *cust){</p>
<p>if(*kwhp &lt; 300){<br />
cost = ((*kwhp) * (first));<br />
}else if(*kwhp &lt; 600){<br />
cost = (300 * first) + ((*kwhp &#8211; 300) * (second));<br />
}else if(*kwhp &lt; 1000){<br />
cost = (300 * first) + ((300) * (second))<br />
+ ((*kwhp &#8211; 600) * (third));<br />
}else if(*kwhp &gt; 1000){<br />
cost = ((300) * (first)) + ((300) * (second))<br />
+ ((400) * (third)) +<br />
((*kwhp &#8211; 1000) * (fourth));<br />
}<br />
if(*cust &amp;&amp; *kwhp != -1){<br />
printf(&#8220;\nCustomer Num: %d&#8221;, *cust);<br />
printf(&#8221; KWH used: %d&#8221;, *kwhp);<br />
printf(&#8221; Charge: %.2f\n&#8221;, cost);<br />
}<br />
return(cost);<br />
}</p>
<p>/* Totaling Values for Final Print */<br />
int totaling(int *kwhp, double *cost){</p>
<p>if(*kwhp != -1){<br />
total_cost += *cost;<br />
total_kwh += *kwhp;<br />
total_customers = ++total_customers;<br />
}else{<br />
printf(&#8220;\nTotal Customers: %d&#8221;, total_customers);<br />
printf(&#8221; Total KWH used %d&#8221;, total_kwh);<br />
printf(&#8221; Total Charges %.2f\n&#8221;, total_cost);<br />
}<br />
return(total_cost, total_kwh, total_customers);<br />
}</p>
<p>int<br />
main(void){<br />
/* Input Values */<br />
int kwh; /* kilowatt-hours per customer */<br />
int cust; /* customer number */</p>
<p>while(kwh != -1 &amp;&amp; cust != -1){<br />
printf(&#8220;Enter customer number and KWH (-1 to quit): &#8220;);<br />
scanf(&#8220;%d %d&#8221;, &amp;cust, &amp;kwh);<br />
charge_calc_kwh(&amp;kwh, &amp;cust);<br />
totaling(&amp;kwh, &amp;cost);<br />
}</p>
<p>system(&#8220;pause&#8221;); /* MMMmm windows */<br />
return (0);<br />
}</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://lettergram.org/338/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>What Godel Has Done.</title>
		<link>http://lettergram.org/what-godel-has-done/</link>
		<comments>http://lettergram.org/what-godel-has-done/#comments</comments>
		<pubDate>Sat, 03 Mar 2012 04:12:27 +0000</pubDate>
		<dc:creator>Lettergram</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://lettergram.org/?p=335</guid>
		<description><![CDATA[]]></description>
			<content:encoded><![CDATA[<p><a href="http://lettergram.org/wp-content/uploads/2012/03/Godel.png"><img class="alignleft size-medium wp-image-336" title="Godel's Incompleteness Theorem" src="http://lettergram.org/wp-content/uploads/2012/03/Godel-300x137.png" alt="" width="300" height="137" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://lettergram.org/what-godel-has-done/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

