Create a "Rectangle" class with "length" and "width" private member variables. The class needs two public member functions: set_dimension() to set the rectangle's length and width to compute its area Create two Rectangle objects in your main function and ask the user for their length and width. Set rectangle length and width using member functions. Compare the rectangles' areas and print out which is larger. Example of programme execution: Rectangle #1's dimensions: 5 4 Rectangle #2's dimensions: 7 3 Larger rectangle #2!

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter11: Introduction To Classes
Section11.2: Basic Class Functions
Problem 5E
icon
Related questions
Question

Create a "Rectangle" class with "length" and "width" private member variables. The class needs two public member functions: set_dimension() to set the rectangle's length and width to compute its area Create two Rectangle objects in your main function and ask the user for their length and width. Set rectangle length and width using member functions. Compare the rectangles' areas and print out which is larger. Example of programme execution: Rectangle #1's dimensions: 5 4 Rectangle #2's dimensions: 7 3 Larger rectangle #2!

Expert Solution
steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Knowledge Booster
Class
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT