WVC JAVA Program Project
Description
Define a new exception class named VarNameException that must inherit
from the Exception class. This class will capture the error case for a
variable name when it is empty, only blanks or starting with a number.
For example, if the user tries to create with a variable name of “”, ” “, or
1name, it will generate an exception and this class should capture the exact reason
and the error value.
2. Update the class named Variable to generate exception with the right error information
using the VarNameException class whenever it is given a variable name
that can be empty, all blanks or starting with a number.
Show how this class being used to create objects and call all its methods and
show how they work.
3. Write a method named createVariable that will read in the variable name from the user
and create a Variable object and return its reference.
This function must handle all error cases for invalid variable names entered by the
user: empty, all blanks or starting with a number by handling exception using
try-catch. It will print out proper error message and continue to ask the user for
the new value until correct name is given.
Please show how this method is being tested and
print out the correct variable information.
Have a similar assignment? "Place an order for your assignment and have exceptional work written by our team of experts, guaranteeing you A results."