Q3: (15 MARKS) Write a C++ program to test the class my Exception defined below by promoting a user to enter their age.

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

Q3: (15 MARKS) Write a C++ program to test the class my Exception defined below by promoting a user to enter their age.

Post by answerhappygod »

Q3 15 Marks Write A C Program To Test The Class My Exception Defined Below By Promoting A User To Enter Their Age 1
Q3 15 Marks Write A C Program To Test The Class My Exception Defined Below By Promoting A User To Enter Their Age 1 (35.18 KiB) Viewed 12 times
Q3: (15 MARKS) Write a C++ program to test the class my Exception defined below by promoting a user to enter their age. If age is less than 19 throw an exception with the default constructor, age between 19 to 35 (inclusive) no exception is thrown, display a message "Access granted.", otherwise throw an exception using a non-default constructor with a message of your choice. Write a complete program (i.e. repeat the class myException on your file). Save the file as myException.cpp class myException { private: string message; public: myException(); myException (string); string what (); myException::myException () ( message "Youngster!"; cout << "Parental attention required!"<< endl; > myException::myException (string msg) ( message msg; cout << "Immediate Attention required!" << endl; ) string myException::what () ( return message; >
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply