Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

c++ language PART 2 Drawing Shapes (15 points) You are requested to design and implement the following functions for the shapes specified in the table

c++ language

image text in transcribed

image text in transcribed

PART 2 Drawing Shapes (15 points) You are requested to design and implement the following functions for the shapes specified in the table draw() function to draw the shape line by line. It may pad blanks by the specified number of blank spaces set by move To() function. It should handle all four shapes in this function. computeArea() to compute the area of the specified shape computeCircumference() to compute the circumference of the specified shape move To (int numOfSpaces) to horizontally move the shape before drawing it. This will determine the horizontal starting point from the current screen position. This function may simply set a global variable to the specified 'num OfSpaces' value. draw() function will pad blank spaces by the specified number of spaces before drawing the object for each line. You are requested to design your own function headers for those 4 basic functions above plus any other functions as needed. Here are some guidelines: The first function parameters may be the type of shapes such as (Rectangle, Square, Circle, Triangle). Use enum type to represent the different shape types. Use switch statements instead of if-statement in handling different shapes in each function. The number of remaining parameters is completely up to you but it should be large enough to handle all different shapes. For example, to compute an area, it would take two parameters(width, height) for a rectangle but only one parameter(side or radius) for a square or circle. Don't forget to include the character type for draw() function You may call move To(x) function to position the starting point of the shape from the current screen position before drawing each shape To fill in a string with the same character n consecutive times without using a loop. Visit the following site and use the option 6 fill string constructor. Shape type Functions comments Draws a rectangle with the specified drawing char. The default char is Rectangle Computes its area and circumference using the specified width and height Square Draws a square with the specified drawing char. 3/6/2021 Program Assignment The default char is Computes its area and circumference using the specified side Triangle Draws an isosceles triangle with the specified drawing char. The default char is ** Computes its area and circumference using the specified base and height Circle Draws a circle with the specified drawing char. The default char is '* See the comments for the drawing instructions Computes its area and circumference using the specified radius . if radius> 2: draw(length) draws a circle with "(" radius spaces ")" . if radius =

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

What is the basis for Security Concerns in Cloud Computing?

Answered: 1 week ago

Question

Describe the three main Cloud Computing Environments.

Answered: 1 week ago