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, 22.06.2019 10:40
"it security policy enforcement and monitoring" respond to the following: describe how monitoring worker activities can increase the security within organizations. describe the rationale that managers should use to determine the degree of monitoring that the organization should conduct. explain the extent to which you believe an organization has the right to monitor user actions and traffic. determine the actions organizations can take to mitigate the potential issues associated with monitoring user actions and traffic.
Answers: 3
question
Computers and Technology, 22.06.2019 10:50
Using least squares fitting, you are to fit the data sets to the following models and solve for the parameters ai , where i is the index of the parameter. the input/output data for the systems are linked in the bblearn site. for each of the systems use matlab to plot the supplied data vs. the model fit on one plot. include your code in the solutions. (a) linear fit "lineardata.mat" y=a1x^3 + a2x^2 + a3x + a4 (b) plant fit "plantdata.mat g(s) = a1/(s + a2)
Answers: 1
question
Computers and Technology, 23.06.2019 09:30
The place where the extended axis of the earth would touch the celestial sphere is called the celestial
Answers: 1
question
Computers and Technology, 23.06.2019 18:30
Report all segments of identity by descent longer than 20 polymorphisms between pairs of individuals in the following cohort of 15 individuals across 49 polymorphisms: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 numeric input 2 points possible (graded) you have 2 attempts to complete the assignment below. for example if the sequence is "bcd", which occurs in "abcdef" , the starting point would be 2 (b), and the finishing point would be 4(d). individuals 7,10 between positions
Answers: 1
You know the right answer?
You will use the following Shape interface to implement a Circle, Triangle, and Rectangle classes. A...
Questions
question
Mathematics, 10.02.2021 23:00
question
Mathematics, 10.02.2021 23:00
question
Mathematics, 10.02.2021 23:00
question
Mathematics, 10.02.2021 23:00
question
Computers and Technology, 10.02.2021 23:00
question
Mathematics, 10.02.2021 23:00
question
Mathematics, 10.02.2021 23:00
question
Mathematics, 10.02.2021 23:00
Questions on the website: 13722362