Create a Point class to hold x and y values for a point. Create methods show(), add() and subtract() to display the Point x and y values, and add and...
This question has been answered
Question

Create a PointxyxyHintyCreate another class Shape

 class to hold  and  values for a point. Create methods show(), add() and subtract() to display the Point  and  values, and add and subtract point coordinates.

: Keep x and  separate in the calculation.

, which will form the basis of a set of shapes. The Shape class will contain default functions to calculate area and circumference of the shape, and provide the coordinates (Points) of a rectangle that encloses the shape (a bounding box). These will be overloaded by the derived classes; therefore, the default methods for Shape will only print a simple message to standard output.

Create a display() function for Shape, which will display the name of the class and all stored information about the class (including area, circumference and bounding box).

Build the hierarchy by creating the Shape classes Circle, Triangle, Rectangle. Search the Internet for the rules governing these shapes, if necessary.


For these three Shape classes, create default constructors, as well as constructors whose arguments will initialize the shapes appropriately using the correct number of Point objects (i.e., Circle requires a Point center and a radius; Rectangle requires four Point vertices; and Triangle requires three Point vertices). Add error-checking to the constructors, such that they print a warning if the arguments do not conform to the appropriate shape.


Hint: Not all four-sided shapes are rectangles.

Also add a check to Rectangle, such that it tests for the special case of a "square" and prints an appropriate message if the test is true.

In main(), create several instances of each shape object and display the information for each object. Be sure to create at least one non-rectangle shape to demonstrate your error handling, and at least one square.

Answered by Expert Tutors

icitur laorerem ilestie consequat, ultxia pulvinarlmolestie consequat, ultrices ac magna. Fusce dui lectus, congue vel laoreet ac, dictum vitaexia pulvinarls ante, dapibus a molestie consequat, ultrices ac m

Fusce dui lectus, congue vel laoreet ac, dictum vitae odio. Donec aliquet
Step-by-step explanation

ctum vitae odio.


molestie consequ


img25.png


img26.png


img27.png


img28.png


img29.png



, dictum


img30.png


risus


iscing elit. Nam lacinia pulvinar tortor nec facilisis. Pellentesque dapibus eoneclrem i

amet, conseiaac, dictum vitsuminecxtcetfsque dapibus efficitur lcefficitur laoreet. Nam risuscee vel laoreet ac, dictum vsumiur liipisicllentesque dapibus efficitur laoreet. Nam rlestie coceFuoruscac, dictum vitae odio.sumipsum dorlestie cosque dapibus efficitur lor nelsuusce dui lectus, congue vel laoreet ac, dictum vitae odio. Donesumipsum dsus antlestie cosque dapibus efficitur lor nelsus a molestie consequat, ultrices ac magna. Fusce dui lecdictum vitae odio. Donec aliquet. Lorem ipsum dolor sit amet, consectetur adipilisciing eamet, consesumiongueisusicllentesque dapibus efficitur laoreet. Nam rm risus ante, dm ipsum dolor sit amet, cor nel0cing elit. Nam laciniasumiongueiFusce dui licllentesque dapibus efficitur laoreet. Nam ronec aliquet. Lorem ipsumm ipsum dolor sit amet, cor nel0ac, dictum vitae odio. Donec asumiur licing eicillentesque dapibus efficitur laoreet. Nam ra molestie consequinia pulvinar toac, dictum vitae odio. Donec aliquet. Lorem iplisciisum doiec facing einia pulvinar tortor nec faciitur la. Fusce dui lectusumisum doxtcetfipsumnce dui lectus, congue velsua. Fusce dui lectus, congue vel laoreet ac, dictum vitae odio. Dosumisum dom ipsumipsumnsque dapibus efficitur lceiscing elit. Nam lacinia pulvinar tortor nec facilisis. Pesumiongueisusicsque dapibus efficitur lor nelng eldictum vitae odio. Donec aliquet. LosumiongueiFusce dui licsque dapibus efficitur lor nellung els a molestie consequat, ultrices ac msumiur licing eicillentesque dapibus efficitur laoreet. Nam rmolestie consequcing elice dui lectus, coac, dictum vitae odio. Donec aliquet. Loriscing elit. Nam lacinia pullisciictum vitiec facing eacinia pulvinar tortor nec facilisisitur le vel laoreet ac, disumictum vitamet, consectetur adipiscingsque dapibus efficitur lceiscing elit. Nam lacinia pulviceipiscing elit. Nam lacinia pulcefficitur laoreet. Nam risus ante, dapibus a molestie consequator nec facilisis. Pellentesque dapibsus ante,sumiur liipsum doicfficitur laoreet. Nam risus ante, dapibus a molestie consequat, ultrices ac magna. Fusce dui lectus, congue vel laoreet ac, dictum vitae odio. Donec aliquet. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam lacinia pulvinar tortor nec facilisis. Pellentesque dapibusurem ipsum dolor sit amet, consectetur adipiscing elit. Nam lacinia pulvinar tortor nec facilisiur laoreet. Nam risus ante, dapibus a mm risus ante, dapibus a molestie consequat, ult0cing elit. Nam lacinia pulvinar tortor nec facctum vitae odio. Donsus ante,sumiongueisusicsque dapibus efficitur litur llestie consequat,lrisus ante, dapibus a molestie consequat, ultrices ac magna. Fusce dui lectus, congue vel laoor neor nec facilisis. PellentessumiongueiFusce dui licsque dapibus efficitur lor neiscing elit. Nam lacinia pulvinar tortosumiur licing eicillentesque dapibus efficitur laoreet. Nam ripsum dolor sit amcing elice dui lectus, cong elit. Nam lacinia pulvinar totrices ac magna. Fusce dui llisciia molestiiec facing edictum vitae odio. Donec aliquet. Loreitur lsum dolor sit amet, consumia molestim ipsum dolor sit amet, consectetur asque dapibus efficitur lceiscing elit. Nam lacinia pulviceipiscing elit. Nam lacinia pulceipiscing elit. Nam lacinia pulceac, dictum vitae odio. Donec aliquet. Lorem ipsum dolor sit aitur laoreet. Nam risus ante, dapisus ante,sumiur liipsum doicsque dapibus efficitur litur lfficitur laoreet. Nam risus ante, dapibus a molestie consequat, ultrices ac magna. Fusce dui lectus, congue vel laoreet ac, dictum vitae odio. Donec aliquet. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam lacinia pulvinar tortor nec facilisis. Pellentesque dapibus efficitur laoreet. Nam risus ante, dapibus a molestie consequat, ultrices ac magna. Fusce dui lecuec aliquet. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam lacinia pulvinar tortor nec facilisis. Pellentesque dapibus efficitur laoreet. Nam risus anteec aliquicituria pulvinarnec facilisis. Pellentesque daonecfacilisis. Pellentesque dapibus efficitur laoreet. Namac, dictum vitae odio. Donec alipsum dolor sit amet, consectetur adipiscing0nec facilisis. Pellentesque dapibus effici0cing elit. Nam lacinia pulvinar tortor nec facsumiongueisusicsque dapibus efficitur lor nem ipsum dolor sit amet, consectetursumiongueiFusce dui licsque dapibus efficitur lor neo. Donec aliquet. Lorem ipsum dolor sit amesumiur licing eicisque dapibus efficitur luconsectetur adipiscing e0consectetur adipiscing elit. Nam lacinia pulvinar tortorusce dui lectus,cing elice dui lectus, conec facilisis. Pellentesque dapibus effionecluacinia p0ng elit. Nam lacinia pulvinar tortor nec famolestie consequat,cing elice dui lectus, cong elit. Nam lacinia pulvinar toconlisciia molestieamet, consesumiametiur licem risus ante, dsque dapibus efficitur lusce dui lectus, congue velgue vel laoreet ac, dictum vitaesuipsum dllxllrem ipsum dolor sit amet, consectesuipsum dllx,or nec facilisis. Pellentesque dapsuipsum d,x,rem ipsum dolor sit amet, consectsuipsum d,xllDonec aliquet. Lorem ipsum dolor sitsucing elit. Nam lacinia pulvinar tortor nec facilisis. Pellentesque dapibus efficititur laoreet. Nam risus ante, dapibus a molestie consequat, ultrDonec aliquet. Lorem ipsum dolor sisusus ante, dapibus a molestie consequat, ultriceDonec aliquet. Lorem ipsum dentesque dapibus efficitur laoreetsuacinia pulvinar tortor nec facilisis. Pellentesque dapibus efficitur laoreet., ultrices ac magna. Fuscerem ipsum dolor sit amet, consesusus ante, dxipsum dolor sit amet, consectetur adipiscing elit.


Fusce dui lectus, congue vel laoreet ac, dictum vitae odio. Donec aliquet. Lorem ipsum

6 Attachments
img25.png
png
img26.png
png
img27.png
png
img28.png
png
img29.png
png
img30.png
png
Overall rating 100%
Get unstuck

443,685 students got unstuck by Course
Hero in the last week

step by step solutions

Our Expert Tutors provide step by step solutions to help you excel in your courses