subject

You will use the following Shape interface to implement a Circle, Triangle, and Rectangle classes. Among the method(s) required by the interface...Circles have a radiusTriangle have a base and heightRectangle have a length and a widthYou will be passed a file name contain shape data from the command line. Some kind of Executive class should read the file and use a ShapeContainer (see below) to store pointers to various shapes, using the specifications for each shape given in the file. The file also contains commands to print the area of a given shape and to exit the program. When a print command is issued, the information about the shape and it's area should be printed. Shape InterfaceYou may NOT add any public methods to this class.#include class Shape{ public: virtual double area() const = 0; virtual std::string shapeName() const = 0; virtual ~Shape() {}};ShapeContainerYou may NOT add any public methods to this class#include "Shape. h"#include class ShapeContainer{ public: ShapeContainer(int size); //initialize pointers in m_arrayOfShapes to nullptr ~ShapeContainer(); double area(int index) const; //throws a std::runtime_error if index is invalid, meaning out of range OR index has nullptr std::string shapeName(index) const; //throws a std::runtime_error if index is invalid, meaning out of range OR index has nullptr void add(Shape* shapePtr, int index); //throws a std::runtime_error if index is invalid OR if shapePtr is nullptr void remove(int index); //throws a std::runtime_error if the index is invalid OR there is no object to delete private: Shape** m_arrayOfShapes; int m_size;}File FormatThe first item in the file will be the size of the shape container, which cannot change despite how many adds are in the file. Following that will be lines containing one of the three following commands in any order:ADDis the index in the container to put the shapewill be CIR, TRI, or REC for Circle, Triangle, and Rectangle respectivelywill the be radius, base and height, or length and width, of a Circle, Triangle, or Rectangle the shape at a given indexThe index may be out of range or not yet set, in which case you must catch and handle the exception to gracefully recover and continue onPRINTPrints the name and area of the shape at a given index, as shown belowThe index may be out of range or not yet set, in which case you must catch and handle the exception to gracefully recover and continue onEXITEnds the program5ADD 0 CIR 5.5ADD 1 TRI 2.5 6.6PRINT 0ADD 2 REC 10.5 20.25PRINT 99PRINT 2 EXITSample run:Shape at index 0: Circle area = 95.0331Shape at index 99: Does not existShape at index 2: Rectangle area = 212.625Exiting...

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 21.06.2019 21:30
What’s the process of observing someone actually working in a career that interests you?
Answers: 1
question
Computers and Technology, 22.06.2019 10:30
This first part of the film shows the early history of motion pictures. how accurate do you think the portrayal of the early motion picture industry is? why? is historical accuracy important in films and theatre productions? explain. in the scene where don is going to the party (starting at time code 14: 51), we see a street scene as he first rides with cosmo and then with kathy. what aspects did the filmmaker include to make the scene look and feel like don, cosmo, and kathy are riding in a car on a street? think about elements such as scenery, sound, props, lighting, and so on. a "talkie" picture is shown starting around time code 21: 15. how does the audience in the film react to the "talkie"? what influence do audiences have on film and theatre performances? how do film and theatre actors influence audiences? in the musical scene with cosmo (starting at time code 27: 00), how does the actor use props? what is the result? do you think the use of props effectively fulfilled the artistic vision for this musical number? why or why not?
Answers: 1
question
Computers and Technology, 22.06.2019 15:30
Melissa needs to add a topic to an email that she will send to her teacher. choose the name of the field where she should type her topic.
Answers: 2
question
Computers and Technology, 22.06.2019 23:30
Jaina and tomas are being considered as new tenants in an apartment. the landlord looks at their creditworthiness because he wants to be sure his new tenant pays the rent on time and in full. the table below summarizes the information that was on their applications. application information questions jaina tomas how many years have you had your job? 5 2 what is your monthly salary? $1,850 $2,500 how many credit cards do you have? 4 1 how much debt do you have? $13,000 $7,000 how many times were you late with payments on credit cards in the past year? 5 1 who will the landlord decide to be more creditworthy and why? tomas because the ratio of his debt to income is less. jaina because she has had her job longer, which makes her look more stable. jaina because she has more credit cards available to her. tomas because he makes more money per month.
Answers: 2
You know the right answer?
You will use the following Shape interface to implement a Circle, Triangle, and Rectangle classes. A...
Questions
question
History, 24.04.2020 19:30
Questions on the website: 13722362