1. C++ Programming Help at HelpWithAssignment.com (If Else Statement Example)<br />Here is an example of an If Else statement example. Here the situation is sales in a company. If 100 units are sold then, $0.25/unit is awarded to the sales executives and if the sales are more than 100 then for the additional units sold an additional incentive of $0.15 is given. <br />#include <iostream><br />using namespace std;<br />void main()<br />{<br /> unsigned int Miles;<br /> const double LessThan100 = 0.25;<br /> const double MoreThan100 = 0.15;<br /> double PriceLessThan100, PriceMoreThan100, TotalPrice;<br /> cout << quot;
Enter the number of miles: quot;
;<br /> cin >> Miles;<br /> if(Miles <= 100)<br /> {<br /> PriceLessThan100 = Miles * LessThan100;<br /> PriceMoreThan100 = 0;<br /> }<br /> else<br /> {<br /> PriceLessThan100 = 100 * LessThan100;<br /> PriceMoreThan100 = (Miles - 100) * MoreThan100;<br /> }<br /> TotalPrice = PriceLessThan100 + PriceMoreThan100;<br /> cout << quot;
Total Price = $quot;
<< TotalPrice << quot;
quot;
;<br />}<br />Here in the program we can see that here two constants are initiated with called the “LessThan100” and “MoreThan100”. In the first case when the sales reach up to 100 then the employee is awarded an incentive of $0.25/unit sold, which means if the sales are 85 units then the incentive would be 85 * 0.025 = 21.25. On the other hand if the sales are more than 100 then the first 100 units are paid $0.25 and the additional units are paid $0.15. <br />This is done by subtracting the 100 from the total sales, multiplying the 100 units with the $0.25 and the additional units is multiplied with $0.15. this gives the total incentive.<br />For example if the sale is 135 units then the incentive would calculated as <br />135-100 = 35; 100 *0.25 = 25 and 35 * 0.15 = 5.25; the total incentive would be 25+5.25 = 30.25. <br />At HelpWithAssignment.com we provide the best quality Assignment help, Homework help and Online Tutoring in C++ and other Programming languages for College and University students. For more details visit our website at http://www.helpwithassignment.com/ http://www.helpwithassignment.com/programing-assignment-help <br />You can follow us on our blogs at http://helpwithassignment.blogspot.com/ and http://helpwithassignment.wordpress.com/ <br />