Homework

Homework Questions? Ask a Tutor for Answers ASAP

Ask an Expert,
Get an Answer ASAP!

This answer was rated:

Lab Assignment 2 In this lab assignment, you will design a…

Lab Assignment 2In this lab...
Lab Assignment 2In this lab assignment, you will design a class that holds an axis-aligned 2D rectangle and is able to determine if two rectangles overlap and if they overlap can calculate their intersection. We will use integers for all coordinates (e.g. as used in raster images or displays). For this assignment, you may assume that the x/y coordinates are all greater or equals 0. If you like to visualize your results assume that the origin of the coordinate system is in the lower left corner and that x is to the right and y goes up (in the usual way). A test driver and the expected output is supplied in main.cpp.Create a source and a header file for your class and name them rectangle.cpp and rectangle.h. Make sure to use the name exactly as typed, otherwise the TAs may return the files to you.Your class rectangle should have four private integer class variables d_x_start, d_x_end, d_y_start and d_y_end. Define a constructor that takes as arguments the lower left corner of a rectangle and its width and height. Design the constructor in such a way that it can be called with all or less aguments including no arguments. Be sure to use initializer lists. If the lower left corner is missing, it should default to -1 and if width and/or height are missing, they should default to 1. As we have assumed that the x and y coordinates are always greater or equals 00, a default constructed rectangle will be {\em invalid}, i.e., we asume that it is not used further. In this assignment, you are not asked to perform error checking as we still have to discuss how this is done in C++.Give your class a function print that simply outputs the four integers to console in the format stop and does not return anything.Design a function intersect in your class which accept an rectangle object as argument and returns true if two triangles overlap. Note that we understand the corners as belonging to a rectangle, i.e., the ranges in x and y are inclusive. Note that axis aligned rectangles, e.g., rectangles A and B, do not overlap if in one dimension the following order of coordinates applies:A_start A_end B_start B_end
B_start B_end A_start A_end
Design a function intersection in your class which accept an rectangle object as argument and returns another rectangle as result. This is easier if you use your overlap test from above. If there is no overlap return a default constructed rectangle. Note that for intersecting axis aligned rectangles, e.g., rectangles A and B, there are four cases for each dimension (and is actually quite simple):A_start B_start A_end B_end
A_start B_start B_end A_end
B_start A_start B_end A_end
B_start A_start A_end B_end
Design a function split in your class with no arguments that returns a standard array of four rectangles. Calculate the position and size of the four rectangles to correspond to the rectangle which the function was called on. Note that for uneven side length, the rectangles should differ in size by 1. Again, the corner points are part of a rectangle. An example is shown hereAn test run of your program will look as follows:Intersection of Rectangle: (3,4) to (12,8) and Rectangle: (8,8) to (10,11)?
Rectangle: (8,8) to (10,8)
Intersection of Rectangle: (3,4) to (12,8) and Rectangle: (4,1) to (13,2)?
No intersection
Intersection of Rectangle: (3,4) to (12,8) and Rectangle: (14,2) to (16,6)?
No intersection
Intersection of Rectangle: (3,4) to (12,8) and Rectangle: (1,2) to (15,10)?
Rectangle: (3,4) to (12,8)Testing split of Rectangle: (3,4) to (12,8)
Rectangle: (3,4) to (7,6)
Rectangle: (8,4) to (12,6)
Rectangle: (8,7) to (12,8)
Rectangle: (3,7) to (7,8)Note you may implement any other private helper function in your class as you see fit.You must hand-in one archive exactly named: rectangle.zip which should contain the two files rectangle.cpp and rectangle.h. Do not hand-in any other files or use any other form of archive. No word files or pdfs (or similar word processing files) will be accepted and if submitted will result in an automatic 0.
Show More
Show Less
Ask Your Own Homework Question
Customer reply replied 10 months ago
will send the code in order to solve it. I need it by tonight please
Answered in 2 hours by:
9/22/2017
LogicPro
LogicPro, Engineer
Category: Homework
Satisfied Customers: 13,500
Experience: Expert in Java C++ C C# VB Javascript Design SQL HTML
Verified

Hi,

Welcome here.

My name is ***** ***** I will help you.

What is the deadline?

Ask Your Own Homework Question
Customer reply replied 10 months ago
12 hours
Customer reply replied 10 months ago
can you finish it please?

yes, I will provide you answer ASAP.

Thank you.

Ask Your Own Homework Question
Customer reply replied 10 months ago
please read the questions

ok

Ask Your Own Homework Question

Please provide expected output also as mentioned in question text.

Ask Your Own Homework Question

Download working code:

http://www.wikisend.com/download/635586/RectangleOverlap.zip

Let me know if you need anything else or leave your rating by selecting five stars located on the top right of the question page. Giving a positive rating compensates the Expert for their time with you. Please remember that your Expert will not be paid until you leave a positive rating for the answer. If the stars are grayed out or you cannot click on the stars to rate your experience, reply to your Expert and let them know so they can adjust your question and allow you to rate.

Please consider adding bonus after rating

http://ww2.justanswer.com/help/what-if-expert-does-really-fantastic-job-hl

You can also come back and add a bonus at a later date by using the "Write a review or give a bonus" button on your question page.

We can continue the conversation until you're satisfied and rate my answer as excellent to credit me. I can address follow up questions and I'm always here to help.

You can ask me again using "For LogicPro only" at the start of your questions like other customers to get instant answers. It will ensure that question is for me.

Please bookmark my profile page:

http://www.justanswer.com/homework/expert-logicpro/

so you can come back and ask me a question anytime.

Thank you for using this site!

LogicPro

Ask Your Own Homework Question
Customer reply replied 10 months ago
Can you please send me the readme file?
How to run the code ?

Which C++ compiler you are using?

Ask Your Own Homework Question
Customer reply replied 10 months ago
i have Drjava and textwrangler and Vim ( command in Mac)
let me use command i guess

its simple if you have run cpp code before. just need to put all files in same folder and run provided test file main.cpp

Ask Your Own Homework Question
Customer reply replied 10 months ago
can you send picture of the test ?
Thanks

here you go:

http://www.wikisend.com/download/968146/screenshot.JPG

Let me know if you got it

Ask Your Own Homework Question
Customer reply replied 10 months ago
What about if I want to run it in command line or powersheel?
I would like to run it here?
How ??
Thanks

I use windows and if cpp files worked on windows it would work on mac too as this is basic code.

You can submit it as it is or if you have not run and want to run, you may need to setup cpp compiler. follow these steps

https://www.dvc.edu/academics/mcsd/computer-science/pdfs/UsingAppleXCode.pdf

As the code is working fine, leave your rating by selecting five stars located on the top right of the question page. I woul dbe happy to help you with any follow up question. Giving a positive rating compensates the Expert for their time with you. Please remember that your Expert will not be paid until you leave a positive rating for the answer. If the stars are grayed out or you cannot click on the stars to rate your experience, reply to your Expert and let them know so they can adjust your question and allow you to rate.

Please consider adding bonus after rating

http://ww2.justanswer.com/help/what-if-expert-does-really-fantastic-job-hl

You can also come back and add a bonus at a later date by using the "Write a review or give a bonus" button on your question page.

We can continue the conversation until you're satisfied and rate my answer as excellent to credit me. I can address follow up questions and I'm always here to help.

You can ask me again using "For LogicPro only" at the start of your questions like other customers to get instant answers. It will ensure that question is for me.

Please bookmark my profile page:

http://www.justanswer.com/homework/expert-logicpro/

so you can come back and ask me a question anytime.

Thank you for using this site!

LogicPro

Ask Your Own Homework Question

You got it my friend?

Ask Your Own Homework Question
Customer reply replied 9 months ago
yeah I got it thanks

Great.

leave your rating by selecting five stars located on the top right of the question page. Giving a positive rating compensates the Expert for their time with you. Please remember that your Expert will not be paid until you leave a positive rating for the answer. If the stars are grayed out or you cannot click on the stars to rate your experience, reply to your Expert and let them know so they can adjust your question and allow you to rate.

Please consider adding bonus after rating

http://ww2.justanswer.com/help/what-if-expert-does-really-fantastic-job-hl

You can also come back and add a bonus at a later date by using the "Write a review or give a bonus" button on your question page.

We can continue the conversation until you're satisfied and rate my answer as excellent to credit me. I can address follow up questions and I'm always here to help.

You can ask me again using "For LogicPro only" at the start of your questions like other customers to get instant answers. It will ensure that question is for me.

Please bookmark my profile page:

http://www.justanswer.com/homework/expert-logicpro/

so you can come back and ask me a question anytime.

Thank you for using this site!

LogicPro

LogicPro
LogicPro, Engineer
Category: Homework
Satisfied Customers: 13,500
Experience: Expert in Java C++ C C# VB Javascript Design SQL HTML
Verified
LogicPro and 87 other Homework Specialists are ready to help you
Ask your own question now

Hi again,

Please read:

https://ww2-secure.justanswer.com/help/do-i-have-rate-answer

http://ww2.justanswer.com/help/how-do-i-rate-answer-hl

Just following up with you to see how everything is going and if you have more questions for me.

We can continue the conversation until you're satisfied and rate my answer as excellent to credit me. I can address follow up questions and I'm always here to help.

You can ask me again using "For LogicPro only" at the start of your questions like you do to get instant answers.

It will ensure that question is for me.

Please bookmark my profile page:

http://www.justanswer.com/homework/expert-logicpro/

so you can come back and ask me a question anytime.

If you need any additional information on this answer, please don't hesitate to ask by clicking on 'Reply to Expert', and I will reply as soon as possible.

I hope you found the information in my answer helpful, and if so, please let me know, here. Thank you!

Thanks very much for using Just Answer!

Best wishes

LogicPro

Ask Your Own Homework Question
This answer is protected
Would you like to ask this question?
If you've already paid for this answer, simply Login.
Was this answer helpful?

How JustAnswer works

step-image
Describe your issueThe assistant will guide you
step-image
Chat 1:1 with a tutorLicensed Experts are available 24/7
step-image
100% satisfaction guaranteeGet all the answers you need
Ask LogicPro Your Own Question
LogicPro
LogicPro
LogicPro, Engineer
Category: Homework
Satisfied Customers: 13,500
13,500 Satisfied Customers
Experience: Expert in Java C++ C C# VB Javascript Design SQL HTML

LogicPro is online now

A new question is answered every 9 seconds

How JustAnswer works:

  • Ask an ExpertExperts are full of valuable knowledge and are ready to help with any question. Credentials confirmed by a Fortune 500 verification firm.
  • Get a Professional AnswerVia email, text message, or notification as you wait on our site. Ask follow up questions if you need to.
  • 100% Satisfaction GuaranteeRate the answer you receive.

JustAnswer in the News:

Ask-a-doc Web sites: If you've got a quick question, you can try to get an answer from sites that say they have various specialists on hand to give quick answers... Justanswer.com.
JustAnswer.com...has seen a spike since October in legal questions from readers about layoffs, unemployment and severance.
Web sites like justanswer.com/legal
...leave nothing to chance.
Traffic on JustAnswer rose 14 percent...and had nearly 400,000 page views in 30 days...inquiries related to stress, high blood pressure, drinking and heart pain jumped 33 percent.
Tory Johnson, GMA Workplace Contributor, discusses work-from-home jobs, such as JustAnswer in which verified Experts answer people’s questions.
I will tell you that...the things you have to go through to be an Expert are quite rigorous.

What Customers are Saying:

Wonderful service, prompt, efficient, and accurate. Couldn't have asked for more. I cannot thank you enough for your help.

Mary C.Freshfield, Liverpool, UK

This expert is wonderful. They truly know what they are talking about, and they actually care about you. They really helped put my nerves at ease. Thank you so much!!!!

AlexLos Angeles, CA

Thank you for all your help. It is nice to know that this service is here for people like myself, who need answers fast and are not sure who to consult.

GPHesperia, CA

I couldn't be more satisfied! This is the site I will always come to when I need a second opinion.

JustinKernersville, NC

Just let me say that this encounter has been entirely professional and most helpful. I liked that I could ask additional questions and get answered in a very short turn around.

EstherWoodstock, NY

Thank you so much for taking your time and knowledge to support my concerns. Not only did you answer my questions, you even took it a step further with replying with more pertinent information I needed to know.

RobinElkton, Maryland

He answered my question promptly and gave me accurate, detailed information. If all of your experts are half as good, you have a great thing going here.

DianeDallas, TX

< Previous | Next >

Meet the Experts:

LogicPro

LogicPro

Engineer

13,500 satisfied customers

Expert in Java C++ C C# VB Javascript Design SQL HTML

Manal Elkhoshkhany

Manal Elkhoshkhany

Tutor

4,556 satisfied customers

More than 5000 online tutoring sessions.

Linda_us

Linda_us

Finance, Accounts & Homework Tutor

3,138 satisfied customers

Post Graduate Diploma in Management (MBA)

Chris M.

Chris M.

M.S.W. Social Work

2,698 satisfied customers

Master's Degree, strong math and writing skills, experience in one-on-one tutoring (college English)

F. Naz

F. Naz

Chartered Accountant

2,190 satisfied customers

Experience with chartered accountancy

Bizhelp

Bizhelp

CPA

1,887 satisfied customers

Bachelors Degree and CPA with Accounting work experience

Seanna

Seanna

Tutor

1,781 satisfied customers

3,000+ satisfied customers, all topics, A+ work

< Previous | Next >

Related Homework Questions
For LogicPro only Using Textpad, create and upload:
For LogicPro only Using Textpad, create and upload: pseudcode file java source code file java class file1. Rectangle Area The area of a rectangle is calculated according to the following formula: Area… read more
LogicPro
LogicPro
Engineer
Bachelor of Technology
13,500 satisfied customers
Assignment 3 2-9 you must submit your code together with the
Assignment 3 For questions 2-9 you must submit your code together with the output of running your code on some sensible sample input. Submit the input and the output of your program along with your co… read more
LogicPro
LogicPro
Engineer
Bachelor of Technology
13,500 satisfied customers
I was wondering if I could get the answer to assignment
Hi I was wondering if I could get the answer to assignment 1 date class in c++ that you posted for previous user http://www.justanswer.com/homework/7ksvy-assignment-1-date-class-necessary.html… read more
ATLProg
ATLProg
Sr Software Engineer
Master\u0027s Degree
46 satisfied customers
1- After compiling my java program, I have this error: illegal
1- After compiling my java program, I have this error: illegal character use 2- I have a help from Logic pro but I can't open the file URL=http://wikisend.com/download/588598/Grade Formatter 1.2.zip]G… read more
Ratheesh Ravi
Ratheesh Ravi
Master\u0027s Degree
114 satisfied customers
Design a Java class named Polygon that contains:  A private
Design a Java class named Polygon that contains:  A private int data field named numSides that defines the number of sides of the polygon. The default value should be 4.  A private double data field… read more
ATLProg
ATLProg
Sr Software Engineer
Master\u0027s Degree
46 satisfied customers
write a program to manipulate strings using pointers. The program
write a program to manipulate strings using pointers. The program will start out by displaying a menu to ask user what to do as shown below: Simple String Manipulation Program Load string Show string … read more
LogicPro
LogicPro
Engineer
Bachelor of Technology
13,500 satisfied customers
i have 2 c++ assignments that i need by this sunday before
i have 2 c++ assignments that i need by this sunday before 6pm. please let me know if you can do it. i have attached the book instructions and professor specific instructions for each assignment. assi… read more
LogicPro
LogicPro
Engineer
Bachelor of Technology
13,500 satisfied customers
Bounding BoxesIn many graphical applications there is the
Bounding Boxes In many graphical applications there is the need to check whether one object is overlapping with some other object. A web browser might check to see if the (x, y) coordinates of a mouse… read more
Mr. Wilson
Mr. Wilson
Teacher
Master\u0027s Degree
200 satisfied customers
For the following small problems, make sure that you create
For the following small problems, make sure that you create a separate MS Visual Studio project for each problem!!! 1. (60 pts) Call this project Computations. Note this problem is similar to Hanly & … read more
LogicPro
LogicPro
Engineer
Bachelor of Technology
13,500 satisfied customers
using java to create a simple drawing program. It will work
deadline for this is by 2pm this Friday using java to create a simple drawing program. It will work by using a matrix as the drawing area, onto which filled rectangles of various sizes and formed from… read more
Expert
Expert
1. (TCO 1) Which of the following would be a more appropriate
1. (TCO 1) Which of the following would be a more appropriate choice for a method in a Cylinder class? (Points : 5) InputRadius() Volume() Radius() Area() 2. (TCO 1) Object-oriented programming genera… read more
ATLProg
ATLProg
Sr Software Engineer
Master\u0027s Degree
46 satisfied customers
Project: Pure Abstract Base class Define a pure abstract
Project: Pure Abstract Base class Define a pure abstract base class called BasicShape. The BasicShape class should have the following members: Private Member Variable: area a double used to hold the s… read more
Raj
Raj
SAP ABAP Consultant
Master\u0027s Degree
27 satisfied customers
(Enhancing Class Rectangle) Create a more sophisticated Rectangle
(Enhancing Class Rectangle) Create a more sophisticated Rectangle class than the one you created in Exercise 9.11. This class stores only the Cartesian coordinates of the four corners of the rectangle… read more
LogicPro
LogicPro
Engineer
Bachelor of Technology
13,500 satisfied customers
I am taking my final, and was hoping to get some help with
I am taking my final, and was hoping to get some help with it...Is anyone available? I really need help with these: 1. (TCO 2) Explain the terms Encapsulation and Data/Information Hiding in object-ori… read more
ATLProg
ATLProg
Sr Software Engineer
Master\u0027s Degree
46 satisfied customers
FOR LOGICPRO ONLY Deadline: I need these by 3/14/2013 please.
FOR LOGICPRO ONLY Deadline: I need these by 3/14/2013 please. Thank you - Inheritance - Shape hierarchy For this assignment 5, please include run time outputs in a .txt file and add it to the Zip. Nec… read more
LogicPro
LogicPro
Engineer
Bachelor of Technology
13,500 satisfied customers
Assignment 5 - Inheritance - Shape hierarchy For this assignment
Assignment 5 - Inheritance - Shape hierarchy For this assignment 5, please include run time outputs in a .txt file and add it to the Zip. Necessary skills: Class inheritance, Member function overridin… read more
ATLProg
ATLProg
Sr Software Engineer
Master\u0027s Degree
46 satisfied customers
PLEASE HELP! I DONT KNOW WHERE TO START!! This is my
PLEASE HELP! I DONT KNOW WHERE TO START!! This is my first programming exercise since leaving the Marines last year...college is hard on an old salt dog...please help. thanks! Java project using: java… read more
LogicPro
LogicPro
Engineer
Bachelor of Technology
13,500 satisfied customers
The first step in designing a class is to figure out what ...
The first step in designing a class is to figure out what the important properties of a rectangle are. Some of the properties of a Rectangle are intrinsic and must be stored as data members of the cla… read more
Scott
Scott
MIT Graduate
Master\u0027s Degree
213 satisfied customers
Disclaimer: Information in questions, answers, and other posts on this site ("Posts") comes from individual users, not JustAnswer; JustAnswer is not responsible for Posts. Posts are for general information, are not intended to substitute for informed professional advice (medical, legal, veterinary, financial, etc.), or to establish a professional-client relationship. The site and services are provided "as is" with no warranty or representations by JustAnswer regarding the qualifications of Experts. To see what credentials have been verified by a third-party service, please click on the "Verified" symbol in some Experts' profiles. JustAnswer is not intended or designed for EMERGENCY questions which should be directed immediately by telephone or in-person to qualified professionals.

Disclaimer: Information in questions, answers, and other posts on this site ("Posts") comes from individual users, not JustAnswer; JustAnswer is not responsible for Posts. Posts are for general information, are not intended to substitute for informed professional advice (medical, legal, veterinary, financial, etc.), or to establish a professional-client relationship. The site and services are provided "as is" with no warranty or representations by JustAnswer regarding the qualifications of Experts. To see what credentials have been verified by a third-party service, please click on the "Verified" symbol in some Experts' profiles. JustAnswer is not intended or designed for EMERGENCY questions which should be directed immediately by telephone or in-person to qualified professionals.

Show MoreShow Less

Ask Your Question

x