Question: Help me get started Assignment 13- Exceptions Due Nov 18 by 11.59pm Points 40 Submitting a file upload File Types opp. h, and hpp Available
Help me get started Assignment 13- Exceptions Due Nov 18 by 11.59pm Points 40 Submitting a file upload File Types opp. h, and hpp Available Oct 28 at 12am-Dec 14 at 11.50pm abot monhs CSIS 123A Lab 13-Exception Handling For this assignment you are going to be adding exoeption handling to your Double and Integer classes Inside Number.h create a class called NumberException. Becase this is going to be a small class you are going to put all of your code inside this file. This means you will not have NumberException.cpp or put any of the code that pertains to NumberException inside a cpp file. This may seem a lile unorthodoxs but the code in this case is very minimal so it i3 going to be ok. The class NumberException should have two variables that make up the data section. The first is an int that will hold an error code. For now, we are not going to be defining emer codes but we wil create this variable with the intent of defining values at some point. The second variable is going to be a string that will hold the error message. Constrectors- You are going to need three constructors for this class. 1. Default constructor Sets set the data of the class to "Unlknown" and- 2 Oveloaded- Takes s sring as an argument. Scts the error message of dests section from the sarig being pesed and the error code value to -1 . Overkoaded takes a string and an int. Sets the data section to the values that are being passed as arguments Functions-This class is going to need two functions 1. get Message- Returns the string the makes up the error message in the data section 2 getCode Retures the value in the data section that holds the error code Throwing the errer You are going to want to throw an error whenever an lnvalid number is being set If you have created one code pa (which I hope you have) then this will be an easy task. Inside the overloaded equals method that takes a string, throw the error anytime an invalid number is being set. This should be somewhere after calling your is NaN string function. The Double class should throw NumberException class with the message "Not a valid double number" and the Integer class should throw the NumbeException class with the message "Not a Number Make sure you provide a throw list for the equals function. functions. Each of these functions should take in a representation of the number as a string. Wrap the code result in a try block. Use a catch block to display the to create the class, perform the selected function, and output the error message set when the error was thrown. Required You must have your name, ID, Date, Assignment number, and a brief description of what the file is in comments at the top of cach page. Failure to do this will result in 10 points being deducted off the top of your grade
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
