In: Computer Science
IN C++ LANGUAGE PLEASE::: Design and implement a program (name it Rectangle) to calculate and display the area and perimeter of a rectangle with width = 4 and height = 8.
#include<iostream>
#include<iomanip>
using namespace std;
int main()
{
//declare the width and height and initialize
//width to 4 and height to 8
//since rectangle is a geometrical figure so width and
height
//are declared as double.
double width=4,height=8;
double area,perimeter;//declare area and
perimeter
//compuet the area of rectangle
area = width * height;
//compuet the perimeter
perimeter = 2 * (width + height);
cout<<endl<<"Width of Rectangle :
"<<width;
cout<<endl<<"Height of rectangle :
"<<height;
//print the area and perimeter
cout<<endl<<"Area of rectangle :
"<<fixed<<setprecision(2)<<area<<" Sq.
Units.";
cout<<endl<<"Perimeter of Rectangle :
"<<fixed<<setprecision(2)<<perimeter<<"
Units.";
}
OUTPUT