Draw a UML class diagram that describes the classes defined below. Setter and getter functions were omitted for simplici

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899604
Joined: Mon Aug 02, 2021 8:13 am

Draw a UML class diagram that describes the classes defined below. Setter and getter functions were omitted for simplici

Post by answerhappygod »

Draw a UML class diagram that describes the classes defined
below. Setter and getter functions were omitted for simplicity.
Your diagram should capture as much information about the code as
possible. Upload a PDF or image file containing your diagram
#include <list>
#include <iostream>
class Object
{
public:
virtual void print() const = 0;
};
class Point : public Object
{
private:
double x,y;
public:
void print() const { std::cout << x << " " <<
y << std::endl; }
};
class Drawable : public Object
{
public:
virtual void draw() const = 0;
};
class Circle : public Drawable
{
private:
Point center;
double radius;
public:
void print() const { center.print(); std::cout << radius
<< std::endl; }
void draw() const { /* ... */ }
};
class Picture : public Drawable
{
private:
std::list<Drawable*> items;
public:
void print() const { for(auto i:items) i->print(); }
void draw() const { for(auto i:items) i->draw(); }
};
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply