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




Assignment Help
Expertsmind Rated 4.9 / 5 based on 47215 reviews.
Review Site
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
Write a program to print out a simplified bill. The customer's name, the number of hours of labor, and the cost of parts and supplies should be entered in response to INPUT
Build a very straightforward and fully functional machine learning classifier with the K-Nearest Neighbor (KNN) algorithm. The KNN model will read a set of data specified by
Fish has an attribute which stores whether the fish is an herbivore or a carnivore. Its eats method checks whether herbivore or carnivore, and prints 'This fish eats veggies
Write a program called "GF2.java" to implement the finite field GF(p n ) where p is a prime number and n is a positive integer.  You also need to write four methods to reali
Explain how the loop displaying the menu is exited, what value does menuSel have when the program finishes? Describe what happens next when menuSel gets this value.
Read in a sum of money and determine the number of quarters, dimes, pennies and nickels represented in the cents portion.  You must get an optimal mix; all pennies, for exam
Write a Java application program that takes in user input from keyboard and calculate semester grade based on the scores. In this assignment, you are going to rewrite the pr
Write an interface, PointingDevice, containing:  an abstract method, getXCoord that returns an int and an abstract method, getYCoord that returns an int.