Hi everyone Im very new to c++ and may be in over my head on this problem im trying to solve. A good visual explanation and solution to my errors or even better a revised source code is all that I ask of. Thanks to everyone who invest there interest into my question.
Heres the problem: Design a class named rectangle to represent a rectangle. The class must contain:
- Two double data fields named width and height that specify the width and height of the rectangle.
- A no-arg constructor that creates a default rectangle with width 1 and height 1.
- A constructor that creates a rectangle with the specified width and height
- The accessor and mutator functions for all data fields
- The function named get Area() that returns the area of this rectangle
- A function named getPerimeter() that returns the peremter.
Draw the UML diagram for the class. Implement the class. Write a test progranm that creates two rectangle obejects. Assign width 4 and height 40 to the first object and width 3.5 and height 35.9 to the second. Display the properties of both objects and find their areas and perimeters.
Heres what I have so far:
#include <iostream>
using namespace std;
class Rectangle
{    
public:      
  double height;
public:
  double width;
  Rectangle()
  {
      width = 4;        
  }
  rectangle(double newArea)
  double height;
  height()
  (
      height = 40
      {
          {
          area = height* width;
          }
  double getArea()
  {
    return Area;
  }
  bool isOn()
  {
    return on;
  }
  double getPerimeter()
  {
    return Perimeter;
  }
  void setPerimeter(double radius)
  cout << "The area of the  Rectangle" 
 << rectangle1.area<<"is"<<rectangle1.getArea()<< endl;
 cout<<"The area of  the Rectangle"
 <<rectangle.area2.area<<"is"<<rectangle2.getArea()<<endl; 
  return 0;
}
 
     
     
     
    