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.


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

Ask Question & Get Answers from Experts
Browse some more (JAVA Programming) Materials
Discuss the legal ramifications of the division of condo, BioTech and other assets. Would it make any difference if Violet sold the property after filing for the dissolution o
We can compare Smalltalk interfaces to classes that use protocols, which are lists of operation names (selectors). When a selector allows parameters, as in at: put: , the se
Millions of commercial airline flights cross the world's cities every year, and each one of these flights must solve what seems like a simple problem: how do you arrange whe
To report the amount of the fine, which is $25 for the first hour or pan of an hour that the car is illegally parked, plus $10 for every additional hour or part of an hour tha
Design your own Java Class that includes at least 3 data fields, 2 constructors and 4 methods. When designing your class, pick an object that you are familiar with and make
In this course, you are introduced to general Windows Server concepts like active directory, group policy, security, networking and IIS, access control, and much more. Now t
Create a Java class called WaterTank.java. This program will simulate thedraining of a cylindrical water catchment tank. Your program will need to show how the rate at which
The program should ask the buyer to enter six digits and should store in an integer array. Six digits should be generated randomly in the range 1 through 20. The digits should