n c++ implement function getPercentage that takes two inputs: grade and total Grade 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.
In c++
implement function getPercentage that takes two inputs: grade and total Grade 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.
Step by step
Solved in 2 steps with 4 images