?Please use the UML diagram and main.cpp to complete the code below tion Point2D
ID: 3775684 • Letter: #
Question
?Please use the UML diagram and main.cpp to complete the code below
tion Point2D T X: T Int y T Point2D tion Point2D(x y T) orCode int) t getX0 T ar t getY0 T int setX(x T) void setY(y T) void public public Circle T Rectangle T width T radius T height: T Rectangle Circle() Rectangle (x y T width T, height T) Circle (x y radius T) getWidth T getRadius0 T getHeight() T setRadius newRadius T) void setWidth (newWidth T) void area0 float setHeight(newHeight T) void circumference() float area() float circumference float public Square T Square (x T y T, side T)Explanation / Answer
#include<math.h>
#include<iostream.h>
#include<conio.h>
#pragama once
#include "Point2D.h"
#include "CustomException.h"
templete<class T>
class Rectangle {
public : void area(float r);
void area(int a,int b);
void area(float a,float b,float d);
};
void Rectangle::area(float r)
{
cout<<"Area of circle="<<(3.14*r*r)
}
void Rectangle::area(float a,float b,float c)
{
float s,ar;
s=(a+b+c)/2;
ar=sqrt(s*(s-a)*(s-b)*(s-c));
cout<<"/n area of traingle="<<ar
}
void main()
{
clrscr();
Rectangle ac;
int r,a,b,c,d;
cout<<"/n choose you option";
cout<<"/n 1.rectangle /n 2.circle /n3.traingle";
cout <<"/n enter your choice:";
cin>>c;
switch(c);
{
case 1:cout<<"/n enter breadth and length:";
cin>>a>>b;
ac.area(a,b);
break;
case 2:cout<<"/n enter radious:";
cin>>r;
ac.area(r);
break;
case 1:cout<<"/n enter three sides:";
cin>>a>>b>>d;
ac.area(a,b,d);
break;
default:count<<"invalid choice";
}
getch();
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.