Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Using the IDE Remember that all code must be submitted in text format. Initial Code & Output Load the following code into the online compiler:

Using the IDE Remember that all code must be submitted in text format. Initial Code & Output Load the following code into the online compiler:

https://www.jdoodle.com/online-compiler-c++/ Please copy the following code into the IDE, compile and run it.

// Program to calculate the area of a rectangle #include  using namespace std; int main() { // Create object of Rectangle class cout<<"A09 - Written by "; // Input Strings string len, wid; int l=0,w=0; // Remove Comment to Create the Rectangle // RRectangle rect(0, 0); // Begin while() loop here cout << " Bye "; return 0; }

result

A09-written by .............

bye.

Problem Note that this is simply a shell to get you started with a clean compile.

The task is to create a Rectangle class that follows the following UML specification

Here are the constraints that you must include in your program.

1) Include an output statement at the beginning of the program with the assignment number and your name: A09 Written by ........

2) Create a single Rectangle object called rect.

3) Implement a while() loop to accept User input for multiple area calculations (reset rect).

4) Implement a break statement to terminate the loop.

5) Each time through the loop, accept user input for 2 integer variables, length (first) and width.

6) Terminate the loop when the user enters x for the length (no need to enter width).

7) Calculate the area of the current rect.

8) Print the area to the console (using rectss getArea() method).

9) Print out an exit greeting (Bye) when exiting the application.

Final Output Once completed, your output (in the following test case) should look like this:

A09- written by.............

please enter length of the rectangle (or 'x' to end) : 4

please enter width of the rectangle : 6

Area = 24.

please enter length of the rectangle (or 'x' to end) : 5

please enter width of the rectangle : 5

Area = 25.

please enter length of the rectangle (or 'x' to end) : x

program Terminated by User

bye

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_2

Step: 3

blur-text-image_3

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

Advanced Database Systems

Authors: Carlo Zaniolo, Stefano Ceri, Christos Faloutsos, Richard T. Snodgrass, V.S. Subrahmanian, Roberto Zicari

1st Edition

155860443X, 978-1558604438

More Books

Students also viewed these Databases questions