Implement function getPercentage that takes two inputs : grade and totalGrade and outputs the grade percentage as follows: percentage = (grade/total grade)*100. (Assume a student can not get a grade above 100%) Define your own exception classes: 1. DivideByZeroException as a derived class of Standard Library class runtime_error, that is used to detect division by zero run time error. 2. NegativeNumberException as a derived class of Standard Library class logic_error, that is used to detect if the user entered a negative number as a grade. 3. InvalidGradeException as a derived class of Standard Library class logic_error, that is used to detect if a user entered an invalid input (grade greater than total grade). Use the above exception classes after implementing them to apply exception handling for your getPercentage function.
Implement function getPercentage that takes two inputs : grade and totalGrade and outputs the grade percentage as follows: percentage = (grade/total grade)*100. (Assume a student can not get a grade above 100%) Define your own exception classes: 1. DivideByZeroException as a derived class of Standard Library class runtime_error, that is used to detect division by zero run time error. 2. NegativeNumberException as a derived class of Standard Library class logic_error, that is used to detect if the user entered a negative number as a grade. 3. InvalidGradeException as a derived class of Standard Library class logic_error, that is used to detect if a user entered an invalid input (grade greater than total grade). Use the above exception classes after implementing them to apply exception handling for your getPercentage function.
Programming Logic & Design Comprehensive
9th Edition
ISBN:9781337669405
Author:FARRELL
Publisher:FARRELL
Chapter11: More Object-oriented Programming Concepts
Section: Chapter Questions
Problem 20RQ
Related questions
Question
Answer in c++ Please.
![Description:
Implement function getPercentage that takes two inputs : grade and totalGrade and outputs the grade
percentage as follows: percentage = (grade/total grade)*100. (Assume a student can not get a grade
above 100%)
Define your own exception classes:
1. DivideByZeroException as a derived class of Standard Library class runtime_error, that is used
to detect division by zero run time error.
2. NegativeNumberException as a derived class of Standard Library class logic_error, that is used
to detect if the user entered a negative number as a grade.
3. InvalidGradeException as a derived class of Standard Library class logic_error, that is used to
detect if a user entered an invalid input (grade greater than total grade).
Use the above exception classes after implementing them to apply exception handling for your
getPercentage function.](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F0510a8e6-3dce-418b-940f-3b471b9c352f%2Fd918bc1d-af7d-478b-9301-b522aaf8462e%2F7s1xv6_processed.jpeg&w=3840&q=75)
Transcribed Image Text:Description:
Implement function getPercentage that takes two inputs : grade and totalGrade and outputs the grade
percentage as follows: percentage = (grade/total grade)*100. (Assume a student can not get a grade
above 100%)
Define your own exception classes:
1. DivideByZeroException as a derived class of Standard Library class runtime_error, that is used
to detect division by zero run time error.
2. NegativeNumberException as a derived class of Standard Library class logic_error, that is used
to detect if the user entered a negative number as a grade.
3. InvalidGradeException as a derived class of Standard Library class logic_error, that is used to
detect if a user entered an invalid input (grade greater than total grade).
Use the above exception classes after implementing them to apply exception handling for your
getPercentage function.
Expert Solution
![](/static/compass_v2/shared-icons/check-mark.png)
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 3 steps with 1 images
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage