Question 1 25 Points Class Figure Contains Following Ax Coordinate Y Coordinate Int Area M Q43842707
Question 1 (25 points): A class figure contains the following: Ax coordinate A y coordinate An int area() method (pure virtual) that computes the area of the figure. A move method (int newX, newY) to set the new location of the figure in a plane A class circle inherits from figure and has: A radius, which is private A constructor that takes the radius Its own implementation of int area(); A class rectangle inherits from figure and has A width, which is private A height, which is private A constructor that takes the width and height Its own implementation of int area); A class square that inherits from rectangle A width, which is private A constructor that takes the width Create all class implementations. Create a main method that tests the creation of a circle with radius 5, a rectangle of dimensions (5, 10), and a square with dimension (15). Print the area of all Question 2 (25 point): Create a class called fancyString that is composed of the following: A content of type char * A flag that indicates whether it is bold or not A flag that indicates whether it is italics or not. A constructor fancyString that takes a pointer to a char to initialize its content A constructor fancyString that takes another fancyString object to initialize it with (make sure you copy construct). Overload cout so that it can print a fancyString. Create fancyString fs1 Create fancyString fs2 = new fancyString(fs1). = new fancyString(“First Example”); 5 points for documentation (inserting proper comments). 5 points for a professional judgment of your overall solution Show transcribed image text Question 1 (25 points): A class figure contains the following: Ax coordinate A y coordinate An int area() method (pure virtual) that computes the area of the figure. A move method (int newX, newY) to set the new location of the figure in a plane A class circle inherits from figure and has: A radius, which is private A constructor that takes the radius Its own implementation of int area(); A class rectangle inherits from figure and has A width, which is private A height, which is private A constructor that takes the width and height Its own implementation of int area); A class square that inherits from rectangle A width, which is private A constructor that takes the width Create all class implementations. Create a main method that tests the creation of a circle with radius 5, a rectangle of dimensions (5, 10), and a square with dimension (15). Print the area of all
Question 2 (25 point): Create a class called fancyString that is composed of the following: A content of type char * A flag that indicates whether it is bold or not A flag that indicates whether it is italics or not. A constructor fancyString that takes a pointer to a char to initialize its content A constructor fancyString that takes another fancyString object to initialize it with (make sure you copy construct). Overload cout so that it can print a fancyString. Create fancyString fs1 Create fancyString fs2 = new fancyString(fs1). = new fancyString(“First Example”); 5 points for documentation (inserting proper comments). 5 points for a professional judgment of your overall solution
Expert Answer
Answer to Question 1 (25 points): A class figure contains the following: Ax coordinate A y coordinate An int area() method (pure v…
OR