SlideShare a Scribd company logo
1 of 1
Download to read offline
Part 2: Tip Calculator Problem Statement: You're out to eat with friends and want to split the
bill, but you're not sure how much to tip. Write a C++ program that calculates the tip amount
based on the total bill and the number of people splitting the bill. The program should prompt the
user to input the following information: 1. The total bill amount 2. The number of people
splitting the bill 3. Tip percentage The program should then calculate the recommended tip and
the total amount owed by each person. The program should output the following information: 1.
The total bill amount 2. Tip amount 3. Total amount owed by each person At the end of each
calculation, the user should be asked if they want to do another calculation or exit the program.
The program must handle all types of bad inputs from user and recover from the errors. Example
run: (User inputs are highlighted!) Enter the total bill amount: 4 fdd 555 Invalid input! Bill
amount must be a float/double! Enter the total bill amount: 150.88 Enter the number of people
splitting the bill: 5.6 Invalid input! Number of people must be a positive integer! Enter the
number of people splitting the bill: 0 Invalid input! Number of people must be a positive integer!
Enter the number of people splitting the bill: 8 Enter the tip percentage, between 1 to 100 (i.e.,
for 15% , enter 15 ): 15 Total bill amount: $150.88 Tip amount: $22.63 ( 15% ) Total amount
owed by each person: $21.69 Do you want to do another calculation? (0-no, 1-yes): 0 Required
function(s): Your program must involve the following functions. You may not change the
parameters or the return type!!! //a function to get bill amount from the user double get_bill();
OR void get_bill (double& bill_amount); //a function to calculate the tip amount double
calculate_tip (double bill_amount, double tip_percentage); OR void calculate_tip (double
bill_amount, double tip_percentage, double& tip);

More Related Content

Similar to Part 2- Tip Calculator Problem Statement- You're out to eat with frien.pdf

As with all projects in this course, your program’s output wil.docx
As with all projects in this course, your program’s output wil.docxAs with all projects in this course, your program’s output wil.docx
As with all projects in this course, your program’s output wil.docx
randymartin91030
 

Similar to Part 2- Tip Calculator Problem Statement- You're out to eat with frien.pdf (6)

INT213 Project Report: Income Tax Calculator
INT213 Project Report: Income Tax CalculatorINT213 Project Report: Income Tax Calculator
INT213 Project Report: Income Tax Calculator
 
As with all projects in this course, your program’s output wil.docx
As with all projects in this course, your program’s output wil.docxAs with all projects in this course, your program’s output wil.docx
As with all projects in this course, your program’s output wil.docx
 
Accenture fico interview-questions
Accenture fico interview-questionsAccenture fico interview-questions
Accenture fico interview-questions
 
Advanced Computer Programming..pptx
Advanced Computer Programming..pptxAdvanced Computer Programming..pptx
Advanced Computer Programming..pptx
 
Cfa level 1 quantitative analysis e book part 1
Cfa level 1 quantitative analysis e book   part 1Cfa level 1 quantitative analysis e book   part 1
Cfa level 1 quantitative analysis e book part 1
 
Log in system
Log in systemLog in system
Log in system
 

More from arcellzone

package ex2- public class Exercise2-E- { private static class N.pdf
package ex2- public class Exercise2-E- {        private static class N.pdfpackage ex2- public class Exercise2-E- {        private static class N.pdf
package ex2- public class Exercise2-E- { private static class N.pdf
arcellzone
 
Part A List five 21st Century Skills you need to develop- Part B Ass.pdf
Part A List five 21st Century Skills you need to develop-   Part B Ass.pdfPart A List five 21st Century Skills you need to develop-   Part B Ass.pdf
Part A List five 21st Century Skills you need to develop- Part B Ass.pdf
arcellzone
 
package linkedLists- import java-util-Iterator- --- A class representi.pdf
package linkedLists- import java-util-Iterator- --- A class representi.pdfpackage linkedLists- import java-util-Iterator- --- A class representi.pdf
package linkedLists- import java-util-Iterator- --- A class representi.pdf
arcellzone
 
package hw1-public class Runner { public static void main(String-- arg (1).pdf
package hw1-public class Runner { public static void main(String-- arg (1).pdfpackage hw1-public class Runner { public static void main(String-- arg (1).pdf
package hw1-public class Runner { public static void main(String-- arg (1).pdf
arcellzone
 

More from arcellzone (20)

package ex2- public class Exercise2-E- { private static class N.pdf
package ex2- public class Exercise2-E- {        private static class N.pdfpackage ex2- public class Exercise2-E- {        private static class N.pdf
package ex2- public class Exercise2-E- { private static class N.pdf
 
Part A List five 21st Century Skills you need to develop- Part B Ass.pdf
Part A List five 21st Century Skills you need to develop-   Part B Ass.pdfPart A List five 21st Century Skills you need to develop-   Part B Ass.pdf
Part A List five 21st Century Skills you need to develop- Part B Ass.pdf
 
Part 5- Use the 105CLl to Gather Device Information (10 points) Issue.pdf
Part 5- Use the 105CLl to Gather Device Information (10 points) Issue.pdfPart 5- Use the 105CLl to Gather Device Information (10 points) Issue.pdf
Part 5- Use the 105CLl to Gather Device Information (10 points) Issue.pdf
 
Part 8- Use the simplified sum-of-minterms expressions to generate the (1).pdf
Part 8- Use the simplified sum-of-minterms expressions to generate the (1).pdfPart 8- Use the simplified sum-of-minterms expressions to generate the (1).pdf
Part 8- Use the simplified sum-of-minterms expressions to generate the (1).pdf
 
Part 2- Character -- Reminder- all data objects should have getters an.pdf
Part 2- Character -- Reminder- all data objects should have getters an.pdfPart 2- Character -- Reminder- all data objects should have getters an.pdf
Part 2- Character -- Reminder- all data objects should have getters an.pdf
 
Part 1- Research the Importance of an IT Asset Inventory Conduct an in.pdf
Part 1- Research the Importance of an IT Asset Inventory Conduct an in.pdfPart 1- Research the Importance of an IT Asset Inventory Conduct an in.pdf
Part 1- Research the Importance of an IT Asset Inventory Conduct an in.pdf
 
Part 2 Water Trace a molecule of water from the renal artery to the re.pdf
Part 2 Water Trace a molecule of water from the renal artery to the re.pdfPart 2 Water Trace a molecule of water from the renal artery to the re.pdf
Part 2 Water Trace a molecule of water from the renal artery to the re.pdf
 
Part 2 1- Create a list of all the IP addresses used to attempt to log.pdf
Part 2 1- Create a list of all the IP addresses used to attempt to log.pdfPart 2 1- Create a list of all the IP addresses used to attempt to log.pdf
Part 2 1- Create a list of all the IP addresses used to attempt to log.pdf
 
Part 11 atratighisini and youngist will the in lith- thery are fiponit.pdf
Part 11 atratighisini and youngist will the in lith- thery are fiponit.pdfPart 11 atratighisini and youngist will the in lith- thery are fiponit.pdf
Part 11 atratighisini and youngist will the in lith- thery are fiponit.pdf
 
Parsing food data lab - Please answer in JAVA Given a text file contai.pdf
Parsing food data lab - Please answer in JAVA Given a text file contai.pdfParsing food data lab - Please answer in JAVA Given a text file contai.pdf
Parsing food data lab - Please answer in JAVA Given a text file contai.pdf
 
Paris Just Got Cheaper for American Tourists Paris- France- Americans.pdf
Paris Just Got Cheaper for American Tourists Paris- France- Americans.pdfParis Just Got Cheaper for American Tourists Paris- France- Americans.pdf
Paris Just Got Cheaper for American Tourists Paris- France- Americans.pdf
 
Parent generation Cross-fertilization F1 generation F2 generationRead.pdf
Parent generation Cross-fertilization F1 generation F2 generationRead.pdfParent generation Cross-fertilization F1 generation F2 generationRead.pdf
Parent generation Cross-fertilization F1 generation F2 generationRead.pdf
 
Paf is a small country- Its currency is the pif- and the exchange rate.pdf
Paf is a small country- Its currency is the pif- and the exchange rate.pdfPaf is a small country- Its currency is the pif- and the exchange rate.pdf
Paf is a small country- Its currency is the pif- and the exchange rate.pdf
 
package linkedLists- import java-util-Iterator- --- A class representi.pdf
package linkedLists- import java-util-Iterator- --- A class representi.pdfpackage linkedLists- import java-util-Iterator- --- A class representi.pdf
package linkedLists- import java-util-Iterator- --- A class representi.pdf
 
package hw1-public class Runner { public static void main(String-- arg (1).pdf
package hw1-public class Runner { public static void main(String-- arg (1).pdfpackage hw1-public class Runner { public static void main(String-- arg (1).pdf
package hw1-public class Runner { public static void main(String-- arg (1).pdf
 
P1) Given the Von Neumann architecture- answer the following questions.pdf
P1) Given the Von Neumann architecture- answer the following questions.pdfP1) Given the Von Neumann architecture- answer the following questions.pdf
P1) Given the Von Neumann architecture- answer the following questions.pdf
 
P1) Answer the following questions (a) We discussed about bottleneck i.pdf
P1) Answer the following questions (a) We discussed about bottleneck i.pdfP1) Answer the following questions (a) We discussed about bottleneck i.pdf
P1) Answer the following questions (a) We discussed about bottleneck i.pdf
 
P1) Answer the following questions ( 40 points) (a) We discussed about.pdf
P1) Answer the following questions ( 40 points) (a) We discussed about.pdfP1) Answer the following questions ( 40 points) (a) We discussed about.pdf
P1) Answer the following questions ( 40 points) (a) We discussed about.pdf
 
Our Space is a social media site that is growing in popularity- The fi.pdf
Our Space is a social media site that is growing in popularity- The fi.pdfOur Space is a social media site that is growing in popularity- The fi.pdf
Our Space is a social media site that is growing in popularity- The fi.pdf
 
P(Zn-kZn1-j)-k!(j)kej (5 points) Let T be the minimal value of n such.pdf
P(Zn-kZn1-j)-k!(j)kej (5 points) Let T be the minimal value of n such.pdfP(Zn-kZn1-j)-k!(j)kej (5 points) Let T be the minimal value of n such.pdf
P(Zn-kZn1-j)-k!(j)kej (5 points) Let T be the minimal value of n such.pdf
 

Recently uploaded

SPLICE Working Group: Reusable Code Examples
SPLICE Working Group:Reusable Code ExamplesSPLICE Working Group:Reusable Code Examples
SPLICE Working Group: Reusable Code Examples
Peter Brusilovsky
 
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
中 央社
 

Recently uploaded (20)

SPLICE Working Group: Reusable Code Examples
SPLICE Working Group:Reusable Code ExamplesSPLICE Working Group:Reusable Code Examples
SPLICE Working Group: Reusable Code Examples
 
Graduate Outcomes Presentation Slides - English (v3).pptx
Graduate Outcomes Presentation Slides - English (v3).pptxGraduate Outcomes Presentation Slides - English (v3).pptx
Graduate Outcomes Presentation Slides - English (v3).pptx
 
When Quality Assurance Meets Innovation in Higher Education - Report launch w...
When Quality Assurance Meets Innovation in Higher Education - Report launch w...When Quality Assurance Meets Innovation in Higher Education - Report launch w...
When Quality Assurance Meets Innovation in Higher Education - Report launch w...
 
e-Sealing at EADTU by Kamakshi Rajagopal
e-Sealing at EADTU by Kamakshi Rajagopale-Sealing at EADTU by Kamakshi Rajagopal
e-Sealing at EADTU by Kamakshi Rajagopal
 
8 Tips for Effective Working Capital Management
8 Tips for Effective Working Capital Management8 Tips for Effective Working Capital Management
8 Tips for Effective Working Capital Management
 
ANTI PARKISON DRUGS.pptx
ANTI         PARKISON          DRUGS.pptxANTI         PARKISON          DRUGS.pptx
ANTI PARKISON DRUGS.pptx
 
Improved Approval Flow in Odoo 17 Studio App
Improved Approval Flow in Odoo 17 Studio AppImproved Approval Flow in Odoo 17 Studio App
Improved Approval Flow in Odoo 17 Studio App
 
The Story of Village Palampur Class 9 Free Study Material PDF
The Story of Village Palampur Class 9 Free Study Material PDFThe Story of Village Palampur Class 9 Free Study Material PDF
The Story of Village Palampur Class 9 Free Study Material PDF
 
Analyzing and resolving a communication crisis in Dhaka textiles LTD.pptx
Analyzing and resolving a communication crisis in Dhaka textiles LTD.pptxAnalyzing and resolving a communication crisis in Dhaka textiles LTD.pptx
Analyzing and resolving a communication crisis in Dhaka textiles LTD.pptx
 
How To Create Editable Tree View in Odoo 17
How To Create Editable Tree View in Odoo 17How To Create Editable Tree View in Odoo 17
How To Create Editable Tree View in Odoo 17
 
Sternal Fractures & Dislocations - EMGuidewire Radiology Reading Room
Sternal Fractures & Dislocations - EMGuidewire Radiology Reading RoomSternal Fractures & Dislocations - EMGuidewire Radiology Reading Room
Sternal Fractures & Dislocations - EMGuidewire Radiology Reading Room
 
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjj
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjjStl Algorithms in C++ jjjjjjjjjjjjjjjjjj
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjj
 
Dementia (Alzheimer & vasular dementia).
Dementia (Alzheimer & vasular dementia).Dementia (Alzheimer & vasular dementia).
Dementia (Alzheimer & vasular dementia).
 
diagnosting testing bsc 2nd sem.pptx....
diagnosting testing bsc 2nd sem.pptx....diagnosting testing bsc 2nd sem.pptx....
diagnosting testing bsc 2nd sem.pptx....
 
“O BEIJO” EM ARTE .
“O BEIJO” EM ARTE                       .“O BEIJO” EM ARTE                       .
“O BEIJO” EM ARTE .
 
Major project report on Tata Motors and its marketing strategies
Major project report on Tata Motors and its marketing strategiesMajor project report on Tata Motors and its marketing strategies
Major project report on Tata Motors and its marketing strategies
 
UChicago CMSC 23320 - The Best Commit Messages of 2024
UChicago CMSC 23320 - The Best Commit Messages of 2024UChicago CMSC 23320 - The Best Commit Messages of 2024
UChicago CMSC 23320 - The Best Commit Messages of 2024
 
demyelinated disorder: multiple sclerosis.pptx
demyelinated disorder: multiple sclerosis.pptxdemyelinated disorder: multiple sclerosis.pptx
demyelinated disorder: multiple sclerosis.pptx
 
Mattingly "AI and Prompt Design: LLMs with Text Classification and Open Source"
Mattingly "AI and Prompt Design: LLMs with Text Classification and Open Source"Mattingly "AI and Prompt Design: LLMs with Text Classification and Open Source"
Mattingly "AI and Prompt Design: LLMs with Text Classification and Open Source"
 
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
 

Part 2- Tip Calculator Problem Statement- You're out to eat with frien.pdf

  • 1. Part 2: Tip Calculator Problem Statement: You're out to eat with friends and want to split the bill, but you're not sure how much to tip. Write a C++ program that calculates the tip amount based on the total bill and the number of people splitting the bill. The program should prompt the user to input the following information: 1. The total bill amount 2. The number of people splitting the bill 3. Tip percentage The program should then calculate the recommended tip and the total amount owed by each person. The program should output the following information: 1. The total bill amount 2. Tip amount 3. Total amount owed by each person At the end of each calculation, the user should be asked if they want to do another calculation or exit the program. The program must handle all types of bad inputs from user and recover from the errors. Example run: (User inputs are highlighted!) Enter the total bill amount: 4 fdd 555 Invalid input! Bill amount must be a float/double! Enter the total bill amount: 150.88 Enter the number of people splitting the bill: 5.6 Invalid input! Number of people must be a positive integer! Enter the number of people splitting the bill: 0 Invalid input! Number of people must be a positive integer! Enter the number of people splitting the bill: 8 Enter the tip percentage, between 1 to 100 (i.e., for 15% , enter 15 ): 15 Total bill amount: $150.88 Tip amount: $22.63 ( 15% ) Total amount owed by each person: $21.69 Do you want to do another calculation? (0-no, 1-yes): 0 Required function(s): Your program must involve the following functions. You may not change the parameters or the return type!!! //a function to get bill amount from the user double get_bill(); OR void get_bill (double& bill_amount); //a function to calculate the tip amount double calculate_tip (double bill_amount, double tip_percentage); OR void calculate_tip (double bill_amount, double tip_percentage, double& tip);