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 17:00
1. so if i wanted to build a linux server for web services(apache) with 1cpu and 2 gb of memory.-operating at 75% of memory capacity2. a windows server with 2 cpu/ 4gb memory- operating at 85% of memory capacity3. a storage server with 1 cpu/ 2gb memory- operating at 85% of memory capacityhow much memory do i have to add for each server.so that the utilization rate for both cpu and memory is at a baseline of 60%."the details for the cpu like its processor or the memory's speed isnt to be concerned" yeah i kept asking my teacher if he's even sure about the but the whole class seems to be confused and the project is due in 3 days..this is a virtualization project where i have to virtualize a typical server into an exsi hypervisor.
Answers: 2
question
Computers and Technology, 22.06.2019 20:00
What statement best describes operating systems? it’s possible for modern computers to function without operating systems. most operating systems are free or very inexpensive. operating systems are managed by the computer’s microprocessor (cpu). operating systems manage the computer’s random access memory (ram).
Answers: 1
question
Computers and Technology, 23.06.2019 19:00
Write a program that displays the following menu: geometry calculator 1. calculate the area of a circle 2. calculate the area of a rectangle 3. calculate the area of a triangle 4. quit enter your choice (1-4): if the user enters 1, the program should ask for the radius of the circle and then display its area. use the following formula: area = ď€(the square of r) use 3.14159 for ď€ and the radius of the circle for r. if the user enters 2, the program should ask for the length and width of the rectangle and then display the rectangle’s area. use the following formula: area = length * width if the user enters 3, the program should ask for the length of the triangle’s base and its height, and then display its area. use the following formula: area = base * height * .5 if the user enters 4, the program should end. input validation: display an error message if the user enters a number outside the range of 1 through 4 when selecting an item from the menu. do not accept negative values for the circle’s radius, the rectangle’s length or width, or the triangle’s base or height. note: if the user enters an improper menu choice (1-4), the program prints "the valid choices are 1 through 4. run the program again and select one of those." if the user enters a negative radius, the program prints "the radius can not be less than zero." if the user enters a negative value for height or base, the program prints "only enter positive values for base and height."
Answers: 1
question
Computers and Technology, 24.06.2019 12:40
Match the feature to the network architecture. expensive to set up useful for a small organization easy to track files has a central server inexpensive to set up difficult to track files useful for a large organization does not have a central server client- server network peer-to-peer network
Answers: 3
You know the right answer?
You will use the following Shape interface to implement a Circle, Triangle, and Rectangle classes. A...
Questions
question
English, 18.09.2020 01:01
question
English, 18.09.2020 01:01
question
Mathematics, 18.09.2020 01:01
question
Mathematics, 18.09.2020 01:01
question
Mathematics, 18.09.2020 01:01
question
Mathematics, 18.09.2020 01:01
question
Mathematics, 18.09.2020 01:01
question
Mathematics, 18.09.2020 01:01
question
Mathematics, 18.09.2020 01:01
question
Mathematics, 18.09.2020 01:01
question
Mathematics, 18.09.2020 01:01
question
Business, 18.09.2020 01:01
question
Mathematics, 18.09.2020 01:01
question
Mathematics, 18.09.2020 01:01
question
Mathematics, 18.09.2020 01:01
question
Mathematics, 18.09.2020 01:01
question
Mathematics, 18.09.2020 01:01
question
English, 18.09.2020 01:01
question
English, 18.09.2020 01:01
Questions on the website: 13722367