SlideShare uma empresa Scribd logo
1 de 2
For assignment submission, use the format listed in the syllabus. Use comments in your code (5
points will be deducted from each problem missing comments) Your solution must include
header, implementation file, and client files. Consider a graphics system that has classes for
various figures rectangles, squares, triangles, circles, and so on. For example, a rectangle might
have data members for height, width, and center point, while a square and circle might have only
a center point and an edge length or radius, respectively. In a well-designed system, these would
be derived from a common class, Figure. You arc to implement such a system. The class Figure
is the base class. You should add only Rectangle and Triangle classes derived from Figure. Each
class has stubs for member tune lions erase and draw. Each of these member functions Outputs a
message telling what function has been called and what the class of the calling object is. Since
these are just stubs, they do nothing more than output this message. The member function center
calls the erase and draw functions to erase and redraw the figure at the center. Since you have
only stubs for erase and draw, center will not do any "centering" but will call the member
functions erase and draw. Also add an output message in the member function center that
announces that center is being called. The member functions should take no arguments. There
are three parts to this project: Write the class definitions using no virtual functions. Compile and
test. Make the base class member functions virtual. Compile and test. Explain the difference in
results. Use the following main function for all testing:
Solution
class Polygon {
public:
virtual void draw()
{ cout<<"Base class draw"; }
virtual void center()
{ cout<<"Base class center"; }
};
class Rectangle: public Polygon {
public:
void draw()
{ cout<<"Rectangle class draw"; }
void center()
{ cout<<"Rectangle class center"; }
};
class Triangle: public Polygon {
public:
void draw()
{ cout<<"Triangle class draw"; }
void center()
{ cout<<"Triangle class center"; }
};

Mais conteúdo relacionado

Semelhante a For assignment submission- use the format listed in the syllabus- Use.docx

GSP 125 Entire Course NEW
GSP 125 Entire Course NEWGSP 125 Entire Course NEW
GSP 125 Entire Course NEWshyamuopten
 
Please make the complete program, Distinguish between header files a.pdf
Please make the complete program, Distinguish between header files a.pdfPlease make the complete program, Distinguish between header files a.pdf
Please make the complete program, Distinguish between header files a.pdfSALES97
 
Object Oriented Solved Practice Programs C++ Exams
Object Oriented Solved Practice Programs C++ ExamsObject Oriented Solved Practice Programs C++ Exams
Object Oriented Solved Practice Programs C++ ExamsMuhammadTalha436
 
abstract,final,interface (1).pptx upload
abstract,final,interface (1).pptx uploadabstract,final,interface (1).pptx upload
abstract,final,interface (1).pptx uploaddashpayal697
 
Example for Abstract Class and Interface.pdf
Example for Abstract Class and Interface.pdfExample for Abstract Class and Interface.pdf
Example for Abstract Class and Interface.pdfrajaratna4
 
Spreadsheets 101
Spreadsheets 101Spreadsheets 101
Spreadsheets 101whita1bd
 
Generic exam
Generic examGeneric exam
Generic examriyadhar
 
School of Computing, Science & EngineeringAssessment Briefin.docx
School of Computing, Science & EngineeringAssessment Briefin.docxSchool of Computing, Science & EngineeringAssessment Briefin.docx
School of Computing, Science & EngineeringAssessment Briefin.docxanhlodge
 
U19CS101 - PPS Unit 4 PPT (1).ppt
U19CS101 - PPS Unit 4 PPT (1).pptU19CS101 - PPS Unit 4 PPT (1).ppt
U19CS101 - PPS Unit 4 PPT (1).pptManivannan837728
 
Presentation 1st
Presentation 1stPresentation 1st
Presentation 1stConnex
 
Oops concept in c#
Oops concept in c#Oops concept in c#
Oops concept in c#ANURAG SINGH
 
Cis 355 ilab 1 of 6
Cis 355 ilab 1 of 6Cis 355 ilab 1 of 6
Cis 355 ilab 1 of 6comp274
 
Cis 355 i lab 1 of 6
Cis 355 i lab 1 of 6Cis 355 i lab 1 of 6
Cis 355 i lab 1 of 6solutionjug4
 

Semelhante a For assignment submission- use the format listed in the syllabus- Use.docx (20)

CREO / PROE QUESTIONS
CREO / PROE QUESTIONSCREO / PROE QUESTIONS
CREO / PROE QUESTIONS
 
GSP 125 Entire Course NEW
GSP 125 Entire Course NEWGSP 125 Entire Course NEW
GSP 125 Entire Course NEW
 
Constructor
ConstructorConstructor
Constructor
 
Please make the complete program, Distinguish between header files a.pdf
Please make the complete program, Distinguish between header files a.pdfPlease make the complete program, Distinguish between header files a.pdf
Please make the complete program, Distinguish between header files a.pdf
 
PPT
PPTPPT
PPT
 
Object Oriented Solved Practice Programs C++ Exams
Object Oriented Solved Practice Programs C++ ExamsObject Oriented Solved Practice Programs C++ Exams
Object Oriented Solved Practice Programs C++ Exams
 
abstract,final,interface (1).pptx upload
abstract,final,interface (1).pptx uploadabstract,final,interface (1).pptx upload
abstract,final,interface (1).pptx upload
 
Example for Abstract Class and Interface.pdf
Example for Abstract Class and Interface.pdfExample for Abstract Class and Interface.pdf
Example for Abstract Class and Interface.pdf
 
CPP Homework Help
CPP Homework HelpCPP Homework Help
CPP Homework Help
 
CPP homework help
CPP homework helpCPP homework help
CPP homework help
 
Object & classes
Object & classes Object & classes
Object & classes
 
Spreadsheets 101
Spreadsheets 101Spreadsheets 101
Spreadsheets 101
 
Generic exam
Generic examGeneric exam
Generic exam
 
School of Computing, Science & EngineeringAssessment Briefin.docx
School of Computing, Science & EngineeringAssessment Briefin.docxSchool of Computing, Science & EngineeringAssessment Briefin.docx
School of Computing, Science & EngineeringAssessment Briefin.docx
 
U19CS101 - PPS Unit 4 PPT (1).ppt
U19CS101 - PPS Unit 4 PPT (1).pptU19CS101 - PPS Unit 4 PPT (1).ppt
U19CS101 - PPS Unit 4 PPT (1).ppt
 
02.adt
02.adt02.adt
02.adt
 
Presentation 1st
Presentation 1stPresentation 1st
Presentation 1st
 
Oops concept in c#
Oops concept in c#Oops concept in c#
Oops concept in c#
 
Cis 355 ilab 1 of 6
Cis 355 ilab 1 of 6Cis 355 ilab 1 of 6
Cis 355 ilab 1 of 6
 
Cis 355 i lab 1 of 6
Cis 355 i lab 1 of 6Cis 355 i lab 1 of 6
Cis 355 i lab 1 of 6
 

Mais de edmundp8cgllams

For this Assignment- submit the following program- The following code.docx
For this Assignment- submit the following program- The following code.docxFor this Assignment- submit the following program- The following code.docx
For this Assignment- submit the following program- The following code.docxedmundp8cgllams
 
For the year ended December 31- 2014- a company- reported the followin.docx
For the year ended December 31- 2014- a company- reported the followin.docxFor the year ended December 31- 2014- a company- reported the followin.docx
For the year ended December 31- 2014- a company- reported the followin.docxedmundp8cgllams
 
For the accompanying inquiries enter the answer and give complete expl.docx
For the accompanying inquiries enter the answer and give complete expl.docxFor the accompanying inquiries enter the answer and give complete expl.docx
For the accompanying inquiries enter the answer and give complete expl.docxedmundp8cgllams
 
Financial managers must understand variance between budgeted expectati.docx
Financial managers must understand variance between budgeted expectati.docxFinancial managers must understand variance between budgeted expectati.docx
Financial managers must understand variance between budgeted expectati.docxedmundp8cgllams
 
Find the domain of the function-.docx
Find the domain of the function-.docxFind the domain of the function-.docx
Find the domain of the function-.docxedmundp8cgllams
 
Financial instruments are assets that have a monetary value or record.docx
Financial instruments are assets that have a monetary value or record.docxFinancial instruments are assets that have a monetary value or record.docx
Financial instruments are assets that have a monetary value or record.docxedmundp8cgllams
 
Fischer esterification and hydrolysis lab Salicylic acid was mixed wit.docx
Fischer esterification and hydrolysis lab Salicylic acid was mixed wit.docxFischer esterification and hydrolysis lab Salicylic acid was mixed wit.docx
Fischer esterification and hydrolysis lab Salicylic acid was mixed wit.docxedmundp8cgllams
 
Financing activities involve- issuing debt- acquiring long-term assets.docx
Financing activities involve- issuing debt- acquiring long-term assets.docxFinancing activities involve- issuing debt- acquiring long-term assets.docx
Financing activities involve- issuing debt- acquiring long-term assets.docxedmundp8cgllams
 
Financial information for Ernie Bishop Company is presented below- ERN.docx
Financial information for Ernie Bishop Company is presented below- ERN.docxFinancial information for Ernie Bishop Company is presented below- ERN.docx
Financial information for Ernie Bishop Company is presented below- ERN.docxedmundp8cgllams
 
Ferritin oxidizes Fe2+ to Fe3+ before mineralizing the iron in the fer.docx
Ferritin oxidizes Fe2+ to Fe3+ before mineralizing the iron in the fer.docxFerritin oxidizes Fe2+ to Fe3+ before mineralizing the iron in the fer.docx
Ferritin oxidizes Fe2+ to Fe3+ before mineralizing the iron in the fer.docxedmundp8cgllams
 

Mais de edmundp8cgllams (10)

For this Assignment- submit the following program- The following code.docx
For this Assignment- submit the following program- The following code.docxFor this Assignment- submit the following program- The following code.docx
For this Assignment- submit the following program- The following code.docx
 
For the year ended December 31- 2014- a company- reported the followin.docx
For the year ended December 31- 2014- a company- reported the followin.docxFor the year ended December 31- 2014- a company- reported the followin.docx
For the year ended December 31- 2014- a company- reported the followin.docx
 
For the accompanying inquiries enter the answer and give complete expl.docx
For the accompanying inquiries enter the answer and give complete expl.docxFor the accompanying inquiries enter the answer and give complete expl.docx
For the accompanying inquiries enter the answer and give complete expl.docx
 
Financial managers must understand variance between budgeted expectati.docx
Financial managers must understand variance between budgeted expectati.docxFinancial managers must understand variance between budgeted expectati.docx
Financial managers must understand variance between budgeted expectati.docx
 
Find the domain of the function-.docx
Find the domain of the function-.docxFind the domain of the function-.docx
Find the domain of the function-.docx
 
Financial instruments are assets that have a monetary value or record.docx
Financial instruments are assets that have a monetary value or record.docxFinancial instruments are assets that have a monetary value or record.docx
Financial instruments are assets that have a monetary value or record.docx
 
Fischer esterification and hydrolysis lab Salicylic acid was mixed wit.docx
Fischer esterification and hydrolysis lab Salicylic acid was mixed wit.docxFischer esterification and hydrolysis lab Salicylic acid was mixed wit.docx
Fischer esterification and hydrolysis lab Salicylic acid was mixed wit.docx
 
Financing activities involve- issuing debt- acquiring long-term assets.docx
Financing activities involve- issuing debt- acquiring long-term assets.docxFinancing activities involve- issuing debt- acquiring long-term assets.docx
Financing activities involve- issuing debt- acquiring long-term assets.docx
 
Financial information for Ernie Bishop Company is presented below- ERN.docx
Financial information for Ernie Bishop Company is presented below- ERN.docxFinancial information for Ernie Bishop Company is presented below- ERN.docx
Financial information for Ernie Bishop Company is presented below- ERN.docx
 
Ferritin oxidizes Fe2+ to Fe3+ before mineralizing the iron in the fer.docx
Ferritin oxidizes Fe2+ to Fe3+ before mineralizing the iron in the fer.docxFerritin oxidizes Fe2+ to Fe3+ before mineralizing the iron in the fer.docx
Ferritin oxidizes Fe2+ to Fe3+ before mineralizing the iron in the fer.docx
 

Último

REMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxREMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxDr. Ravikiran H M Gowda
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.christianmathematics
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and ModificationsMJDuyan
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibitjbellavia9
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxJisc
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...pradhanghanshyam7136
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSCeline George
 
Interdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxInterdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxPooja Bhuva
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxRamakrishna Reddy Bijjam
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxAreebaZafar22
 
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...Amil baba
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17Celine George
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfAdmir Softic
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsMebane Rash
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfSherif Taha
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.MaryamAhmad92
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structuredhanjurrannsibayan2
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.pptRamjanShidvankar
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Jisc
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...Nguyen Thanh Tu Collection
 

Último (20)

REMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxREMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptx
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptx
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
Interdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxInterdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptx
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structure
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 

For assignment submission- use the format listed in the syllabus- Use.docx

  • 1. For assignment submission, use the format listed in the syllabus. Use comments in your code (5 points will be deducted from each problem missing comments) Your solution must include header, implementation file, and client files. Consider a graphics system that has classes for various figures rectangles, squares, triangles, circles, and so on. For example, a rectangle might have data members for height, width, and center point, while a square and circle might have only a center point and an edge length or radius, respectively. In a well-designed system, these would be derived from a common class, Figure. You arc to implement such a system. The class Figure is the base class. You should add only Rectangle and Triangle classes derived from Figure. Each class has stubs for member tune lions erase and draw. Each of these member functions Outputs a message telling what function has been called and what the class of the calling object is. Since these are just stubs, they do nothing more than output this message. The member function center calls the erase and draw functions to erase and redraw the figure at the center. Since you have only stubs for erase and draw, center will not do any "centering" but will call the member functions erase and draw. Also add an output message in the member function center that announces that center is being called. The member functions should take no arguments. There are three parts to this project: Write the class definitions using no virtual functions. Compile and test. Make the base class member functions virtual. Compile and test. Explain the difference in results. Use the following main function for all testing: Solution class Polygon { public: virtual void draw() { cout<<"Base class draw"; } virtual void center() { cout<<"Base class center"; } }; class Rectangle: public Polygon { public: void draw() { cout<<"Rectangle class draw"; } void center() { cout<<"Rectangle class center"; } };
  • 2. class Triangle: public Polygon { public: void draw() { cout<<"Triangle class draw"; } void center() { cout<<"Triangle class center"; } };