+1-415-670-9189
info@expertsmind.com
Java classes that are implementations of the rectangle class
Course:- JAVA Programming
Reference No.:- EM13942125




Assignment Help
Assignment Help >> JAVA Programming

The Class for a Rectangle is shown below. PlaneRectangle is a specialisation of Rectangle with fields that define the location of the centre of the rectangle. Write Java Classes that are implementations of the Rectangle Class and of the PlaneRectangle Class.

1436_rec.png

Now add methods to the Java PlaneRectangle Class that:

a. enable the location of an instance of PlaneRectangle to be moved by a specified distance (expressed as a change in the x-coordinate, and a change in the y-coordinate).

b. Enable a check to be made that a given point lies inside or outside the rectangle.

c. Enable a check to be made that another instance of PlaneRectangle lies completely within the current instance.

These classes come with default "constructor methods". Write the Java code for new constructors for the Rectangle Class that enable:

a. An instance of the Rectangle Class to be created with a default length of 1.0. and a default width of 1.0.

b. An instance of the Rectangle Class can be created with user specified values for the length and width.Now add constructors to the PlaneRectangle Class to enable:

a. An instance of the PlaneRectangle Class to be created with the above default length and width, and located at the origin by default.

b. An instance of the PlaneRectangle Class to be created with user specified values for the length, width and location.

Write a Java application that enables the user to specify the length, width and location of two instances of a PlaneRectangle and check whether the first lies completely within the second.




Put your comment
 
Minimize


Ask Question & Get Answers from Experts
Browse some more (JAVA Programming) Materials
Create a Servlet that displays a form when the doGet method is invoked. The form will contain a post action that directs the form post back to the same servlet, which in doP
Write a program with an exception handler that deals with nonnumeric operands; then write another program without using an exception handler to achieve the same objective.
Understand actual communication with an SMTP server can be achieved using TCP Sockets and understand the development of a graphical user interface (GUI) and use of event handl
Imagine that you have been assigned to implement a sorting program. The goal is to make this program general purpose, in that you don't want to define in advance what recor
create acircle class, which has one field, the radius. the class should contains two constructors: a no-argument constructor that set the radius to zero, and a constructor tha
Write a Java program that can serve as a simple calculator. This calculator keeps track of a single number (of type double) that is called result and that starts out as 0.0.
Develop an app that generates a random number and prompts the user to guess the number - When the user clicks the New Game Button, the app selects a number in the range 1 to 1
Create Java application which will input miles driven and gallons used (both as integers) for each tankful. Program must compute and display miles per gallon obtained for ea