SlideShare a Scribd company logo
1 of 1
8.5 LAB: Exception handling to detect input string vs. int The given program reads a list of
single-word first names and ages (ending with -1), and outputs that list with the age incremented.
The program fails and throws an exception if the second input on a line is a string rather than an
int. At FIXME in the code, add a try/catch statement to catch ios_base: : failure, and output 0 for
the age. Ex: If the input is: Lee 18 Lua 21 Mary Beth 19 Stu 33 1 then the output is: Lee 19 Lua
22 Mary 0 Stu 34

More Related Content

More from GordonyTaMackayk

7- What are the similarities between these surface features- What does.docx
7- What are the similarities between these surface features- What does.docx7- What are the similarities between these surface features- What does.docx
7- What are the similarities between these surface features- What does.docx
GordonyTaMackayk
 
7-) Some molecular data place the giant panda in the bear family (Ursi.docx
7-) Some molecular data place the giant panda in the bear family (Ursi.docx7-) Some molecular data place the giant panda in the bear family (Ursi.docx
7-) Some molecular data place the giant panda in the bear family (Ursi.docx
GordonyTaMackayk
 
7- The fact that the vast majority of bacteria multiply by binary fiss.docx
7- The fact that the vast majority of bacteria multiply by binary fiss.docx7- The fact that the vast majority of bacteria multiply by binary fiss.docx
7- The fact that the vast majority of bacteria multiply by binary fiss.docx
GordonyTaMackayk
 

More from GordonyTaMackayk (20)

8- Explain in detail- how is P2P file distribution concept is used in.docx
8- Explain in detail- how is P2P file distribution concept is used in.docx8- Explain in detail- how is P2P file distribution concept is used in.docx
8- Explain in detail- how is P2P file distribution concept is used in.docx
 
8- Dr- Dolly teaches composition at a two year community college- He c.docx
8- Dr- Dolly teaches composition at a two year community college- He c.docx8- Dr- Dolly teaches composition at a two year community college- He c.docx
8- Dr- Dolly teaches composition at a two year community college- He c.docx
 
7- What are the similarities between these surface features- What does.docx
7- What are the similarities between these surface features- What does.docx7- What are the similarities between these surface features- What does.docx
7- What are the similarities between these surface features- What does.docx
 
8- 25 Points- To satisfy this question- a- Create a file under the -tm.docx
8- 25 Points- To satisfy this question- a- Create a file under the -tm.docx8- 25 Points- To satisfy this question- a- Create a file under the -tm.docx
8- 25 Points- To satisfy this question- a- Create a file under the -tm.docx
 
8- (7 points)- Consider the following network that operates if and onl.docx
8- (7 points)- Consider the following network that operates if and onl.docx8- (7 points)- Consider the following network that operates if and onl.docx
8- (7 points)- Consider the following network that operates if and onl.docx
 
76) A lot of N-50 products are produced with 4 known to be defective-.docx
76) A lot of N-50 products are produced with 4 known to be defective-.docx76) A lot of N-50 products are produced with 4 known to be defective-.docx
76) A lot of N-50 products are produced with 4 known to be defective-.docx
 
74 Igmeouss Rocks Vilmene rexis ane moks that have on wallind frum las.docx
74 Igmeouss Rocks Vilmene rexis ane moks that have on wallind frum las.docx74 Igmeouss Rocks Vilmene rexis ane moks that have on wallind frum las.docx
74 Igmeouss Rocks Vilmene rexis ane moks that have on wallind frum las.docx
 
7-1 Discussion- WorldCom- What Happened- Communication and group dynam.docx
7-1 Discussion- WorldCom- What Happened- Communication and group dynam.docx7-1 Discussion- WorldCom- What Happened- Communication and group dynam.docx
7-1 Discussion- WorldCom- What Happened- Communication and group dynam.docx
 
75- of Puerto Ricans who immigrated to the United States After the ear.docx
75- of Puerto Ricans who immigrated to the United States After the ear.docx75- of Puerto Ricans who immigrated to the United States After the ear.docx
75- of Puerto Ricans who immigrated to the United States After the ear.docx
 
7-Consider a regression model Yi-xi2+xii where the independent random.docx
7-Consider a regression model Yi-xi2+xii where the independent random.docx7-Consider a regression model Yi-xi2+xii where the independent random.docx
7-Consider a regression model Yi-xi2+xii where the independent random.docx
 
7-) Some molecular data place the giant panda in the bear family (Ursi.docx
7-) Some molecular data place the giant panda in the bear family (Ursi.docx7-) Some molecular data place the giant panda in the bear family (Ursi.docx
7-) Some molecular data place the giant panda in the bear family (Ursi.docx
 
7- Use the data in the table below to calculate the mean difference- D.docx
7- Use the data in the table below to calculate the mean difference- D.docx7- Use the data in the table below to calculate the mean difference- D.docx
7- Use the data in the table below to calculate the mean difference- D.docx
 
7- What is a digital dashboard- Why is a dashboard needed instead of j.docx
7- What is a digital dashboard- Why is a dashboard needed instead of j.docx7- What is a digital dashboard- Why is a dashboard needed instead of j.docx
7- What is a digital dashboard- Why is a dashboard needed instead of j.docx
 
7- What charparteristics differentiate the radius and 8- Indicate the.docx
7- What charparteristics differentiate the radius and 8- Indicate the.docx7- What charparteristics differentiate the radius and 8- Indicate the.docx
7- What charparteristics differentiate the radius and 8- Indicate the.docx
 
7- The following is a generic monomer used in DNA synthesis- Label the.docx
7- The following is a generic monomer used in DNA synthesis- Label the.docx7- The following is a generic monomer used in DNA synthesis- Label the.docx
7- The following is a generic monomer used in DNA synthesis- Label the.docx
 
7- The image below shows profiles of three couples (A-B and C) as well.docx
7- The image below shows profiles of three couples (A-B and C) as well.docx7- The image below shows profiles of three couples (A-B and C) as well.docx
7- The image below shows profiles of three couples (A-B and C) as well.docx
 
7- The following are good practice related to Java Exception Handling.docx
7- The following are good practice related to Java Exception Handling.docx7- The following are good practice related to Java Exception Handling.docx
7- The following are good practice related to Java Exception Handling.docx
 
7- The fact that the vast majority of bacteria multiply by binary fiss.docx
7- The fact that the vast majority of bacteria multiply by binary fiss.docx7- The fact that the vast majority of bacteria multiply by binary fiss.docx
7- The fact that the vast majority of bacteria multiply by binary fiss.docx
 
7- Over time- mitochondrial DNA accumulates non-lethal mutations at a.docx
7- Over time- mitochondrial DNA accumulates non-lethal mutations at a.docx7- Over time- mitochondrial DNA accumulates non-lethal mutations at a.docx
7- Over time- mitochondrial DNA accumulates non-lethal mutations at a.docx
 
7- If -5-5--0-1-n-16- what is a x and x - x--x-- 8- n-150--6-2--10-99-.docx
7- If -5-5--0-1-n-16- what is a x and x - x--x-- 8- n-150--6-2--10-99-.docx7- If -5-5--0-1-n-16- what is a x and x - x--x-- 8- n-150--6-2--10-99-.docx
7- If -5-5--0-1-n-16- what is a x and x - x--x-- 8- n-150--6-2--10-99-.docx
 

Recently uploaded

The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
heathfieldcps1
 

Recently uploaded (20)

REMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxREMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptx
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - English
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxCOMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
 
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
 
Wellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxWellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptx
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
 
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptxExploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentation
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
 
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
 
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
 
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
 
Plant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptxPlant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptx
 
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptxOn_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
 
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Ă...
 

8-5 LAB- Exception handling to detect input string vs- int The given p.docx

  • 1. 8.5 LAB: Exception handling to detect input string vs. int The given program reads a list of single-word first names and ages (ending with -1), and outputs that list with the age incremented. The program fails and throws an exception if the second input on a line is a string rather than an int. At FIXME in the code, add a try/catch statement to catch ios_base: : failure, and output 0 for the age. Ex: If the input is: Lee 18 Lua 21 Mary Beth 19 Stu 33 1 then the output is: Lee 19 Lua 22 Mary 0 Stu 34