Programming language is C Code must include exceptionhandlin
Programming language is C++. Code must include exception-handling framework too.
Many national flags are very similar except for the colors . write a class Scandinavian_flag that can construct the flags of Denmark, Finland, and Sweden, and a main which creates each flag like this: Scandinavian_flag Denmark{white, red}; and so on, and draws all three flags with the country name underneath. Name your progam hw6pr3.cpp. Note: Don \'t worry about any variations in the proportions of the different flags, just make the flags recognizable as belonging to that country.Solution
Class Scandivanian_flag
{
Scandivanian_flag:: Scandivanian_flag Denmark{white,red}
{
int drawFlag(Image& g){
g.fillColor(\"red\");
g.draw(DrawableRectangle(0,0,400,300));
g.fillColor(\"white\");
g.draw(DrawableRectangle(0,125,400,175));
g.draw(DrawableRectangle(175,0,225,300));
g.drawText(rect(), Qt::AlignCenter, \"DenmarkFlag\");
return 0;
}
Scandivanian_flag:: Scandivanian_flag sweden{yellow,blue}
{
int drawFlag(Image& g){
g.fillColor(\"blue\");
g.draw(DrawableRectangle(0,0,400,300));
g.fillColor(\"yellow\");
g.draw(DrawableRectangle(0,125,400,175));
g.draw(DrawableRectangle(175,0,225,300));
g.drawText(rect(), Qt::AlignCenter, \"Sweden Flag\");
return 0;
}
Scandivanian_flag:: Scandivanian_flag finland{blue,white}
{
int drawFlag(Image& g){
g.fillColor(\"white\");
g.draw(DrawableRectangle(0,0,100,100));
g.fillColor(\"blue\");
g.draw(DrawableRectangle(0,125,400,175));
g.draw(DrawableRectangle(300,0,225,300));
g.drawText(rect(), Qt::AlignCenter, \"finlandFlag\");
return 0;
}
//please adjust the values in the recangle function for more appropriate flag diagrams
