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

Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please Practise
AnaAcapella
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
ZurliaSoop
 

Recently uploaded (20)

Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structure
 
Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please Practise
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxHMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptxSKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
 
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 setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxHow to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptx
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.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Ữ Â...
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfUnit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
Interdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxInterdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptx
 
Wellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxWellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptx
 

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