Question: 1) Debug, (find the errors and correct them in), the program, T2-Debug cpp (worth 20 points): Note: a. The file is attached with this part
1) Debug, (find the errors and correct them in), the program, T2-Debug cpp (worth 20 points): Note: a. The file is attached with this part of the test download it. b. Note that there are 6 errors. c. For debug assignments Overall Assignment worth 2 points: i. DO NOT take out comments ii. DO NOT rearrange the code! iii. DO NOT change the code standards! d. Each error you find is worth 3 points for 18 points total. i. Find the bug ii. Fix the bug iii. Document the bug in the code to make it easy to fine iv. You will lose points for incorrectly fixing the bug. e. The program should run correctly when you have found and corrected all 6 errors. Some are syntax and some are logic errors. f. Submit both source code (*.cpp file) and screen print of running program (your output). // Test 2 Part B Debug Program // Find the 6 errors #include using namespace std; class CPolygon { protected: int width, height; public: void set_values (int a, int b) { width=a; height=b;} }; class COutput { void output (int i); }; void COutput::output (int i) { cout << j << endl; } class CRectangle: public CPolygon, public COutput { public: int area () { return (width * height); } }; class CTriangle: public CPolygon { public: int area () { return (width * height / 2); } }; // Function to hold screen open before any exit. void holdscreen( ) { char holdscr; cout << " \t Enter 1 character then hit return to exit program. "; cin >> holdscr; return; } int main () { CRectangle rect; CTriangle trgl; // First set of Values cout << " First set of values are 4 and 5 -- Results are: "; rect.set_values (4,5); trgl.set_values (45); rect.output (rect.area()); trgl.output (trgl.area()); // Second set of Values cout << " Second set of values are 10 and 3 -- Results are: ;" rect.set_values (10,3); trgl.set_values (10,3); rect.output (rect.area()); trgl.output (trgl.area()); // third set of Values cout << " Third set of values are 7 and 7 -- Results are: "; rect.set_values (7,7); trgl.set_values (7,7); rect.output (rect.area()); trgl.output (tgrl.area()); // Hold window open to see results holdscreen( ); return 0; } Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
