Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
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
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started