Answered step by step
Verified Expert Solution
Question
1 Approved Answer
C++ PROGRAMMING: PLEASE MAKE SURE THE PROGRAM COMPILES AND RUNS FOR 5 STARS :-) HERE IS THE CODE TO EDIT BELOW (PLEASE ONLY ADD CODE):
C++ PROGRAMMING: PLEASE MAKE SURE THE PROGRAM COMPILES AND RUNS FOR 5 STARS :-)
HERE IS THE CODE TO EDIT BELOW (PLEASE ONLY ADD CODE):
#include#include using namespace std; class DimError { private: string message; public: //implement the methods }; class Rectangle { private: int length, width; public: //implement the methods }; int main(void) { Rectangle r; try { while (true) { int l, w; cout > l; cout > w; r.setLength(l); r.setWidth(w); cout objectives: 1. Handling exceptions within a pro 2. Using trylcatch block 3. Creating exception class Question: Design a program that repeatedly asks for the dimensions (length and width of a rectangle and computes the area. Consider a class Rectangle which includes the following two functions: void Rectangle setWidth (int width) void Rectangle setLength (int length) If the length and width are positive, then above functions store the values in the Rectangle object. However, if the length and width are negative, the functions throw an object of Dim.Error class that includes a message indicating which method was called and the reason for the error. Note: DimError class is used by the Rectangle class for showing error messages
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