Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Can someone help me with this? It's C++. I'm uploading the requirements the professor is asking for. The only required library I have to include

  • Can someone help me with this? It's C++. I'm uploading the requirements the professor is asking for. The only "required" library I have to include is iostream, but it's possible to use any other library in addition if needed. Just in case if needed, we're using Visual Studio, but I don't think that's a piece of relevant information for the assignment.

image text in transcribedimage text in transcribed
Problem 3: 1. Write a class of Shape that has two member variables, perimeter and area, and pure virtual functions to calculate the perimeter and area of the shape. It also contains two additional member variables: a. m_name[10]: a string with no more than 10 characters for the name of the object b. m_ID: an integer index of the object. 2. Write a class of Color with a member variable that can be red, yellow, blue, black, and white. 3. Write three classes for rectangle, triangle, and circle objects, derived from the class of Shape and Color for objects with the shape of triangle, rectangle, or circle, and any of the colors defined in the class of Color. 4. Write necessary constructor/destructor functions, accessor/mutator functions for each class. a. print: print the pertinent information for a given shape and color b. calculate: calculate the area and perimeter for the current shape 5. Your program should read the object info from an input file called input-3-3.txt, which lists the index, object name, color, length of each side (radius if it is a circle), similar as follows: 1 myrect rectangle red 20 30 2 mygriangle triangle blue 10 30 35 3 mycircle circle blue 25 4 rect2 rectangle blue 30 40 -... 6. Your program needs to calculate the perimeter and area of each object, and set the object's color to be black if its area is larger than the overall average of all objects and white otherwise. Your program should output the following information to another file called output-3-3.txt. Please name your main file as prog-3-3.cpp. a. The overall average area of all objects b. The index, name, perimeter, area, colorX Sample_input_3-3 (1) - Notepad File Edit Format View Help myrect rectangle red 20 30 mytriangle triangle blue 10 30 35 mycircle circle blue 25 rect1 rectangle yellow 100 408 rect2 rectangle blue 302 40 cir1 circle black 345 tril triangle white 320 560 280 tri2 triangle red 45 87 63 cir2 circle red 78 10 cir4 circle yellow 43

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

Financial management theory and practice

Authors: Eugene F. Brigham and Michael C. Ehrhardt

12th Edition

978-0030243998, 30243998, 324422695, 978-0324422696

Students also viewed these Programming questions

Question

Describe the key elements of the marketing control system.

Answered: 1 week ago