Question
Define an exception class called tornadoException. The class should have two constructors, including the default constructor. If the exception is thrown with the default constructor,
Define an exception class called tornadoException. The class should have two constructors, including the default constructor. If the exception is thrown with the default constructor, the method what should return "Tornado: Take cover immediately!". The other constructor has a single parameter, say, m, of the int type. If the exception is thrown with this constructor, the method what should return "Tornado: m miles away; and approaching!". You decide what value of m should be used to trigger the non-default warning. Write a program to test this class.
Here is a standard way to create the message using the integer parameter. There are nonstandard ways to do this which are compiler-dependent. Please use this method for this program so you will know what to do if you use a compiler that does not support one of the nonstandard methods.
#include
Turn in your tornadoException.h file and your test program. Also turn in one or more screen shots showing the results of your testing.
Once completed you will demonstrate that you can
Construct a user-defined exception class.
Throw an exception which generates a default message
Throw an exception which generates a message from a parameter sent through an exception object.
Handle an exception using catch blocks.
Generate a string which incorporates a numeric value using the stringstream library.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started