Answered step by step
Verified Expert Solution
Link Copied!

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 WHAT

C++ PROGRAMMING: PLEASE MAKE SURE THE PROGRAM COMPILES AND RUNS FOR 5 STARS :-)

image text in transcribed

HERE IS THE CODE TO EDIT BELOW (PLEASE ONLY ADD WHAT IT ASKS DO NOT CHANGE 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.  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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database And Expert Systems Applications 31st International Conference Dexa 2020 Bratislava Slovakia September 14 17 2020 Proceedings Part 1 Lncs 12391

Authors: Sven Hartmann ,Josef Kung ,Gabriele Kotsis ,A Min Tjoa ,Ismail Khalil

1st Edition

303059002X, 978-3030590024

More Books

Students also viewed these Databases questions