Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need this answered where i could just copy and paste the answer in to Visual studio and it runs fully. If possible a explanation

image text in transcribed

I need this answered where i could just copy and paste the answer in to Visual studio and it runs fully. If possible a explanation of all the steps

Q4 (50 pts). Write a Square class having two data values: side length of the square as integer and bottom-left point of the square (as a Point). An example square with side length 1 and bottom-left point (0,0) is shown below. Assume the sides of the squares are parallel to x and y coordinates. You should use point struct defined in Q3. Include the following functions in the class. a. (10 pts) Write two constructors. Default constructor should set side length to 5 and bottom-left point to (0,0) point. Explicit-value constructor should accept three parameters and sets those values as side length and (x,y) coordinates of the bottom-left point. However, if the side length is less than or equal to 0 , the constructor should print an error message and sets it to 10. b. (10 pts) Write getters and setters for the side length and bottom-left point such as getSideLength, setSideLength, getBottomLeftX, setBottomLeftX, getBottomLeftY, and setBottomLeftY. If the parameter of setSideLength is not positive, do not change the side length and print an error message. c. (5 pts) Write two functions getArea and getCircumference that returns the area and circumference of the square, respectively. d. (10 pts) Write a function named contains that takes a Point as parameter and returns true if the point is inside the square, false otherwise. e. (10 pts) Write a function named intersects that takes a Square s as parameter and returns true if the square object intersects with the Square s, false otherwise. f. (5 pts) Write a function named display to print the square objects by displaying all data members. For a square with side length 3 and bottom-left (4,5), it should display: " side length: 3 , bottom-left point: (4,5)". The function returns nothing

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Databases Organizing Information Digital And Information Literacy

Authors: Greg Roza

1st Edition

1448805929, 978-1448805921

Students also viewed these Databases questions

Question

What are some potential interview problems?

Answered: 1 week ago

Question

Show the properties and structure of allotropes of carbon.

Answered: 1 week ago