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 tutorialEdTechonGC Mallett
 
Sales tax and tip powerpoint
Sales tax and tip  powerpointSales tax and tip  powerpoint
Sales tax and tip powerpointtigergirl823
 
Commission
CommissionCommission
CommissionNora
 
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 answersMydear student
 
Percentages
PercentagesPercentages
Percentagesserpio
 
Percentage & profit and loss
Percentage & profit and lossPercentage & profit and loss
Percentage & profit and lossPawan Mishra
 
S5 pre reading percentage_final
S5 pre reading percentage_finalS5 pre reading percentage_final
S5 pre reading percentage_finalPraveen Tyagi
 
Quantitative Aptitude - Profit & Loss
Quantitative Aptitude  -  Profit & LossQuantitative Aptitude  -  Profit & Loss
Quantitative Aptitude - Profit & LossKaushal Kumar
 
Aptitude Training - PROFIT AND LOSS
Aptitude Training - PROFIT AND LOSSAptitude Training - PROFIT AND LOSS
Aptitude Training - PROFIT AND LOSSAjay Chimmani
 
Mark Up And Discount
Mark Up And DiscountMark Up And Discount
Mark Up And DiscountJessca Lundin
 
PROFIT & LOSS FOR COMPETITIVE EXAMS
PROFIT & LOSS FOR COMPETITIVE EXAMSPROFIT & LOSS FOR COMPETITIVE EXAMS
PROFIT & LOSS FOR COMPETITIVE EXAMSYamini Kahaliya
 
Types Of Commission
Types Of CommissionTypes Of Commission
Types Of Commissionste 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 priceswidzith
 
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 companyIbrahim Khan Md.
 
Interpreting accounting information for sole proprietors
Interpreting accounting information for sole proprietorsInterpreting accounting information for sole proprietors
Interpreting accounting information for sole proprietorsChris 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.docxbudbarber38650
 
Principle of microeconomic.pptx
Principle of microeconomic.pptxPrinciple of microeconomic.pptx
Principle of microeconomic.pptxFaayAbdiaziz
 
Casestudy 01 algorithms
Casestudy 01 algorithmsCasestudy 01 algorithms
Casestudy 01 algorithmsrawaha134
 
Profit contribution analysis breakeven
Profit contribution analysis breakevenProfit contribution analysis breakeven
Profit contribution analysis breakevenAyush Malviya
 
Solve Percentages
Solve PercentagesSolve Percentages
Solve Percentagesdcsangwan
 
Profit & loss Online coaching PPT.pdf
Profit & loss Online coaching PPT.pdfProfit & loss Online coaching PPT.pdf
Profit & loss Online coaching PPT.pdfAkashKumarSinha7
 
December 6, 2013
December 6, 2013December 6, 2013
December 6, 2013khyps13
 
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 ACOSSearch Scientists
 
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 organisationHarshit Agarwal
 

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

call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsanshu789521
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceSamikshaHamane
 
Hierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementHierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementmkooblal
 
Pharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfPharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfMahmoud M. Sallam
 
Biting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfBiting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfadityarao40181
 
Types of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxTypes of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxEyham Joco
 
Painted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaPainted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaVirag Sontakke
 
Meghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentMeghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentInMediaRes1
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon AUnboundStockton
 
Capitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitolTechU
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxRaymartEstabillo3
 
CELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxCELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxJiesonDelaCerna
 

Recently uploaded (20)

call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha elections
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in Pharmacovigilance
 
Hierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementHierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of management
 
Pharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfPharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdf
 
Biting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfBiting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdf
 
Types of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxTypes of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptx
 
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
 
Painted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaPainted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of India
 
Meghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentMeghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media Component
 
OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon A
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
Capitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptx
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
ESSENTIAL of (CS/IT/IS) class 06 (database)
ESSENTIAL of (CS/IT/IS) class 06 (database)ESSENTIAL of (CS/IT/IS) class 06 (database)
ESSENTIAL of (CS/IT/IS) class 06 (database)
 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
 
CELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxCELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.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 />