Implement the class and write a test program that creates a

Assignment Help JAVA Programming
Reference no: EM131193373

Define the MyRectangle2D class that contains: 

  • Two double data fields named x and y that specify the center of the rectangle with get and set methods. (Assume that the rectangle sides are parallel to the x- or y-axes.) 
  • The data fields width and height with get and set methods. 
  • A no-arg constructor that creates a default rectangle with (0, 0) for (x, y) and 1 for both width and height. 
  • A constructor that creates a rectangle with specified x, y, width, and height. 
  • A method getArea() that returns the area of the rectangle. ? A method getPerimeter() that returns the perimeter of the rectangle. 
  • A method contains (double x, double y) that returns true if the specified point (x, y) is inside the rectangle. See Figure (a) 
  • A method contains (Rectangle2D r) that returns true if the specified rectangle is inside this rectangle. See Figure (b) 
  • A method overlaps (Rectangle2D r) that returns true if the specified rectangle overlaps with this rectangle. See Figure (c)

920_Untitled picture.png

Implement the class and write a test program that creates a Rectangle2D object r1 (new Rectangle2D (2, 2, 5.5, 4.9)), displays its area and perimeter, and displays the results of r1.contains (3, 3), r1.contains (new Rectangle2D (4, 5, 10.5, 3.2)), and r1.overlaps (new Rectangle2D (3, 5, 2.3, 5.4)).

Please note, your implementation will be tested with other test cases too.

Reference no: EM131193373

Questions Cloud

Suppose the transmitter technology changes : Suppose the transmitter technology changes, and it becomes economicalfor an individual household. The trading city will [grow, shrink, disappear]
Do you think teams in the hospitality industry are effective : The success of the hospitality industry is especially dependent on teamwork. In order to provide exceptional customer service, team members need to have the same focus and goals. Forming a team can be a tedious process. Identify the designations and ..
Determine the angle u corresponding to equilibrium : A uniform rod AB of length 2R rests inside a hemispherical bowl of radius R as shown. Neglecting friction, determine the angle u corresponding to equilibrium.
Prepare journal entries for each transaction : Prepare journal entries for each transaction and post each transaction to the appropriate ledger accounts (use T- account format) - Prepare trial balance dated March 31,2016
Implement the class and write a test program that creates a : Implement the class and write a test program that creates a Rectangle2D object r1 (new Rectangle2D (2, 2, 5.5, 4.9)), displays its area and perimeter, and displays the results of r1.contains (3, 3), r1.contains (new Rectangle2D (4, 5, 10.5, 3.2)), an..
Why should organization consider utilizing systems analysis : Why should an organization consider utilizing a systems analysis and design methodology when building a new system instead of building a system in any which way that seems to be fast and simple? What value is provided by using an engineering approach..
Fiscal austerity policy : Why did many EU government use fiscal austerity policy in 2010-2015? What was the impact of this policy on business in these countries.
What are the short and long term benefits : Do you are the U.S government continue with free trades program (NAFTA)? what is the benefit for Americans? What are the short and long term benefits?
Choices in industrial and organizational psychology : Based on outside resources (journals, websites, interviews, etc.) what are three possible career choices in Industrial and Organizational Psychology?

Reviews

Write a Review

JAVA Programming Questions & Answers

  Recursive factorial program

Write a class Array that encapsulates an array and provides bounds-checked access. Create a recursive factorial program that prompts the user for an integer N and writes out a series of equations representing the calculation of N!.

  Hunt the wumpus game

Reprot on Hunt the Wumpus Game has Source Code listing, screen captures and UML design here and also, may include Javadoc source here.

  Create a gui interface

Create GUI Interface in java programing with these function: Sort by last name and print all employees info, Sort by job title and print all employees info, Sort by weekly salary and print all employees info, search by job title and print that emp..

  Plot pois on a graph

Write a JAVA program that would get the locations of all the POIs from the file and plot them on a map.

  Write a university grading system in java

University grading system maintains number of tables to store, retrieve and manipulate student marks. Write a JAVA program that would simulate a number of cars.

  Wolves and sheep: design a game

This project is designed a game in java. you choose whether you'd like to write a wolf or a sheep agent. Then, you are assigned to either a "sheep" or a "wolf" team.

  Build a graphical user interface for displaying the image

Build a graphical user interface for displaying the image groups (= cluster) in JMJRST. Design and implement using a Swing interface.

  Determine the day of the week for new year''s day

This assignment contains a java project. Project evaluates the day of the week for New Year's Day.

  Write a java windowed application

Write a Java windowed application to do online quiz on general knowledge and the application also displays the quiz result.

  Input pairs of natural numbers

Java program to input pairs of natural numbers.

  Create classes implement java interface

Interface that contains a generic type. Create two classes that implement this interface.

  Java class, array, link list , generic class

These 14 questions covers java class, Array, link list , generic class.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd