SlideShare a Scribd company logo
1 of 2
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 />
C++ Programming with If Else example

More Related Content

What's hot

Percentages and discounts tutorial
Percentages and discounts tutorialPercentages and discounts tutorial
Percentages and discounts tutorial
EdTechonGC Mallett
 
Sales tax and tip powerpoint
Sales tax and tip  powerpointSales tax and tip  powerpoint
Sales tax and tip powerpoint
tigergirl823
 
Quantitative Aptitude - Profit & Loss
Quantitative Aptitude  -  Profit & LossQuantitative Aptitude  -  Profit & Loss
Quantitative Aptitude - Profit & Loss
Kaushal Kumar
 
Types Of Commission
Types Of CommissionTypes Of Commission
Types Of Commission
ste ve
 

What's hot (20)

Percentages and discounts tutorial
Percentages and discounts tutorialPercentages and discounts tutorial
Percentages and discounts tutorial
 
Sales tax and tip powerpoint
Sales tax and tip  powerpointSales tax and tip  powerpoint
Sales tax and tip powerpoint
 
Commission
CommissionCommission
Commission
 
temp
temptemp
temp
 
Profit and loss aptitude questions and answers
Profit and loss aptitude questions and answersProfit and loss aptitude questions and answers
Profit and loss aptitude questions and answers
 
Percentages
PercentagesPercentages
Percentages
 
Percentage & profit and loss
Percentage & profit and lossPercentage & profit and loss
Percentage & profit and loss
 
S5 pre reading percentage_final
S5 pre reading percentage_finalS5 pre reading percentage_final
S5 pre reading percentage_final
 
Percentage math basics
Percentage math basicsPercentage math basics
Percentage math basics
 
The Percentages Pack
The Percentages PackThe Percentages Pack
The Percentages Pack
 
Quantitative Aptitude - Profit & Loss
Quantitative Aptitude  -  Profit & LossQuantitative Aptitude  -  Profit & Loss
Quantitative Aptitude - Profit & Loss
 
Profit and Loss
Profit and LossProfit and Loss
Profit and Loss
 
Percentage
PercentagePercentage
Percentage
 
Aptitude Training - PROFIT AND LOSS
Aptitude Training - PROFIT AND LOSSAptitude Training - PROFIT AND LOSS
Aptitude Training - PROFIT AND LOSS
 
Mark Up And Discount
Mark Up And DiscountMark Up And Discount
Mark Up And Discount
 
PROFIT & LOSS FOR COMPETITIVE EXAMS
PROFIT & LOSS FOR COMPETITIVE EXAMSPROFIT & LOSS FOR COMPETITIVE EXAMS
PROFIT & LOSS FOR COMPETITIVE EXAMS
 
Ch 2 profit and loss
Ch 2 profit and lossCh 2 profit and loss
Ch 2 profit and loss
 
Discount and commission
Discount and commissionDiscount and commission
Discount and commission
 
Cost cantrol
Cost cantrolCost cantrol
Cost cantrol
 
Types Of Commission
Types Of CommissionTypes Of Commission
Types Of Commission
 

Similar to C++ Programming with If Else example

Setting a price
Setting a priceSetting a price
Setting a price
swidzith
 
Interpreting accounting information for sole proprietors
Interpreting accounting information for sole proprietorsInterpreting accounting information for sole proprietors
Interpreting accounting information for sole proprietors
Chris Bell
 
Fundamentals of EconomicsA. Profit MaximizationProfit Maximi.docx
Fundamentals of EconomicsA. Profit MaximizationProfit Maximi.docxFundamentals of EconomicsA. Profit MaximizationProfit Maximi.docx
Fundamentals of EconomicsA. Profit MaximizationProfit Maximi.docx
budbarber38650
 
December 6, 2013
December 6, 2013December 6, 2013
December 6, 2013
khyps13
 

Similar to C++ Programming with If Else example (20)

Setting a price
Setting a priceSetting a price
Setting a price
 
How to design a universal incentive system for a manufacturing company
How to design a universal incentive system for a manufacturing companyHow to design a universal incentive system for a manufacturing company
How to design a universal incentive system for a manufacturing company
 
Home
HomeHome
Home
 
Percentages
PercentagesPercentages
Percentages
 
Interpreting accounting information for sole proprietors
Interpreting accounting information for sole proprietorsInterpreting accounting information for sole proprietors
Interpreting accounting information for sole proprietors
 
Matemática
MatemáticaMatemática
Matemática
 
Fundamentals of EconomicsA. Profit MaximizationProfit Maximi.docx
Fundamentals of EconomicsA. Profit MaximizationProfit Maximi.docxFundamentals of EconomicsA. Profit MaximizationProfit Maximi.docx
Fundamentals of EconomicsA. Profit MaximizationProfit Maximi.docx
 
Percentages.pptx
Percentages.pptxPercentages.pptx
Percentages.pptx
 
Principle of microeconomic.pptx
Principle of microeconomic.pptxPrinciple of microeconomic.pptx
Principle of microeconomic.pptx
 
Class7(ch 2.2)
Class7(ch 2.2)Class7(ch 2.2)
Class7(ch 2.2)
 
Casestudy 01 algorithms
Casestudy 01 algorithmsCasestudy 01 algorithms
Casestudy 01 algorithms
 
Rate of increase & decrease
Rate of increase & decreaseRate of increase & decrease
Rate of increase & decrease
 
Profit contribution analysis breakeven
Profit contribution analysis breakevenProfit contribution analysis breakeven
Profit contribution analysis breakeven
 
Solve Percentages
Solve PercentagesSolve Percentages
Solve Percentages
 
Customer Life Time Value
Customer Life Time Value Customer Life Time Value
Customer Life Time Value
 
Profit & loss Online coaching PPT.pdf
Profit & loss Online coaching PPT.pdfProfit & loss Online coaching PPT.pdf
Profit & loss Online coaching PPT.pdf
 
December 6, 2013
December 6, 2013December 6, 2013
December 6, 2013
 
ICP - Lecture 9
ICP - Lecture 9ICP - Lecture 9
ICP - Lecture 9
 
Ecommerce Marketing: Calculating Minimum ROAS and maximum ACOS
Ecommerce Marketing: Calculating Minimum ROAS and maximum ACOSEcommerce Marketing: Calculating Minimum ROAS and maximum ACOS
Ecommerce Marketing: Calculating Minimum ROAS and maximum ACOS
 
Estimation of manpower in a sales organisation
Estimation of manpower in a sales organisationEstimation of manpower in a sales organisation
Estimation of manpower in a sales organisation
 

Recently uploaded

Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdf
Chris Hunter
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
negromaestrong
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
PECB
 

Recently uploaded (20)

Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdf
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
 
Asian American Pacific Islander Month DDSD 2024.pptx
Asian American Pacific Islander Month DDSD 2024.pptxAsian American Pacific Islander Month DDSD 2024.pptx
Asian American Pacific Islander Month DDSD 2024.pptx
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptx
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-IIFood Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 

C++ Programming with If Else example

  • 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 />