Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help on single-subscripted array

Status
Not open for further replies.

8888

Programmer
Apr 7, 2000
2
US
I also need help on writing this program. Hehehe I'm new at this.<br><br>Use a single-subscripted array to solve the following program.&nbsp;&nbsp;A company pays its salespeople on a commission basis.&nbsp;&nbsp;The salespeople receive $200 per week plus 9% of their gross sales for that week.&nbsp;&nbsp;For example, a salesperson who grosses $5000 in sales in a week receive $200 plus 9% of $5000, or a total of $650.<br>Write a program (using an array of counters) that determines how many of the salespeople earned salaries in each of the following ranges (assume that each saleperson's) salary is truncated to an integer amount:<br>&nbsp;&nbsp;&nbsp;1.&nbsp;&nbsp;$200 - $299<br>&nbsp;&nbsp;&nbsp;2.&nbsp;&nbsp;$300 - $399<br>&nbsp;&nbsp;&nbsp;3.&nbsp;&nbsp;$400 - $499<br>&nbsp;&nbsp;&nbsp;4.&nbsp;&nbsp;$500 - $599<br>&nbsp;&nbsp;&nbsp;5.&nbsp;&nbsp;$600 - $699<br>&nbsp;&nbsp;&nbsp;6.&nbsp;&nbsp;$700 - $799<br>&nbsp;&nbsp;&nbsp;7.&nbsp;&nbsp;$800 - $899<br>&nbsp;&nbsp;&nbsp;8.&nbsp;&nbsp;$900 - $999<br>&nbsp;&nbsp;&nbsp;9.&nbsp;&nbsp;$1000 and over<br><br>The help is appreciated.&nbsp;&nbsp;Thank you
 
I am writing the Pseudocode.<br><br>int array[9]&nbsp;&nbsp;= {0,0,0,0,0,0,0,0,0};<br>int counter = 1,sal;<br>do {<br>printf(&quot;Enter the Basic salary for employee # %d&quot;,counter);<br>counter++;<br>fflush(stdin);<br>scanf(&quot;%d&quot;,&sal);<br>array[( ((200 + 0.09 * sal) / 100) - 2)] += 1;<br>printf(&quot;Is there more staff(y/n)?&quot;)<br>fflush(stdin);<br>scanf(&quot;%c&quot;,&ch);<br>}while(ch != 'n');<br><br><br>Finally the array will contain number of emplyoee in each category .<br>Does this answer your question ?<br><br>Thanx<br>Siddhartha Singh<br><A HREF="mailto:ssingh@aztecsoft.com">ssingh@aztecsoft.com</A>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top