subject

Implementing the following object oriented programming constructions.1. Member FunctionsReplace the eight supporting output functions with member functions in the eight struct s. Name the functions as you like, but name them all the same. Their prototypes inside the structs should all look exactly alike, all with exactly one parameter -- an ostream reference. Modify the function called from the console and file output loops in int main accordingly.2. Stream ManipulatorsReplace the formatting code blocks in each output function with the manipulators provided in the module.3. Conditional OperatorsIf you have not already done so, apply the conditional operator so that there are no more if-else statements to convert tokens to dimensions.#include#include#include #include#include#include#include#in cludeusing namespace std;struct Square{ double side;};void outputSquare(ostream&, const Square&);struct Rectangle{ double length; double width;};void outputRectangle(ostream&, const Rectangle&);struct Circle{ double radius;};void outputCircle(ostream&, const Circle&);struct Triangle{ double side;};void outputTriangle(ostream&, const Triangle&);struct Cube{ double side;};void outputCube(ostream&, const Cube&);struct Box{ double length; double width; double height;};void outputBox(ostream&, const Box&);struct Cylinder{ double radius; double height;};void outputCylinder(ostream&, const Cylinder&);struct Prism{ double side; double height;};void outputPrism(ostream&, const Prism&);vector parseString(string);int main(){ ifstream infile("Shapes. input. txt"); ofstream fout; fout. open("Shapes. output. txt"); vector bag; vector bagType; string str; vector tokens; while (!infile. eof()) { getline(infile, str); tokens = parseString(str); if (tokens. size() != 0) { if (tokens[0] == "SQUARE") { Square* s = new Square(); if (tokens. size() > 1) s->side = atof(tokens[1].c_str()); else s->side = 0; bag. push_back(s); bagType. push_back(1);}//there's way more shapes, I just had to cut it out to make this question shorter else { if (tokens[0] == "EOF") continue; cout << tokens[0] << " Invalid Object" << endl; } } } for (unsigned int i = 0; i < bag. size(); i++) { if (bagType[i] == 1) { Square* xSquare = reinterpret_cast(bag[i]); Square& ySquare = *xSquare; outputSquare(cout, ySquare); } }//there's way more shapes, I just had to cut it out to make this question shorter for (unsigned int i = 0; i < bag. size(); i++) { if (bagType[i] == 1) { Square* xSquare = reinterpret_cast(bag[i]); Square& ySquare = *xSquare; outputSquare(fout, ySquare); } }//there's way more shapes, I just had to cut it out to make this question shorter for (unsigned int i = 0; i < bag. size(); i++) { if (bagType[i] == 1) { Square* xSquare = reinterpret_cast(bag[i]); delete xSquare; } }//there's way more shapes, I just had to cut it out to make this question shorter fout. close(); return 0;}vector parseString(string str){ stringstream s(str); istream_iterator begin(s), end; return vector(begin, end);}void outputSquare(ostream& fout, const Square& s){ double area, perimeter; area = s. side * s. side; perimeter = 4 * s. side; fout << "SQUARE side = " << s. side << " area = " << fixed << setprecision(2) << area << " perimeter = " << fixed << setprecision(2) << perimeter << "\n";}

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 21.06.2019 20:40
Convert and simplify the following sentences to conjunctive normal form (cnf): (a) (p → (q → r)) → (p → (r → q)) (b) (p ∧ q) → (¬p ↔ q) (c) ((p → q) ∧ ¬q) → ¬p
Answers: 3
question
Computers and Technology, 22.06.2019 22:30
What is the most popular genre of video games?
Answers: 1
question
Computers and Technology, 23.06.2019 06:30
Who can provide you with a new password when you have forgotten your old one? your provide you with a new password in case you forget your old one.
Answers: 3
question
Computers and Technology, 23.06.2019 09:30
You wanted to look up information about alzheimer's, but you were unsure if it was spelled "alsheimer's" or "alzheimer's." which advanced search strategy would be useful? a) a boolean search b) using a wild card in your search c) trying different search engines d) doing a search for "alsheimer's not alzheimer's" asap. ill give brainlist.
Answers: 1
You know the right answer?
Implementing the following object oriented programming constructions.1. Member FunctionsReplace the...
Questions
question
Mathematics, 19.08.2019 14:30
question
Mathematics, 19.08.2019 14:30
question
Mathematics, 19.08.2019 14:30
question
Mathematics, 19.08.2019 14:30
Questions on the website: 13722361