Define a static max method in the geometricobject class

Assignment Help JAVA Programming
Reference no: EM13782345

Instructions: Properly indent your code and include appropriate comments. Follow instructions given for each problem in the textbook.

Required

EnableGeometricObject comparable

Modify the GeometricObject class to implement the Comparable interface, and define a static max method in the GeometricObject class for finding the larger of two GeometricObject objects. Use the provied UML diagram and implement the new GeometricObject1, Circle1, and Rectangel1 classes. Write a test program that uses the max method to find the larger of two circles and the larger of two rectangles.
Sample main provided.

*Hint create a new GeometricObject class called GeometricObject1 which will implement Comparable.

abstract class GeometricObject1 implements Comparable<GeometricObject1>

GeommetricObject1 will need to have a compareTo method and the method
public static GeometricObject1 max(GeometricObject1 o1,GeometricObject1 o2)

{

which will use the compareTo method to return the relationship between o1 and o2, the value, 0,1, or -1.

You will also need a class Circle1 that extends GeometricObject1.

class Circle1 extends GeometricObject1

{

You will also need a class Rectangle1 that extends GeometricObject1.

classRectangle1 extends GeometricObject1

{

Classes GeometricObject, Circle and Rectangle have been provided for you as a starting point.

Reference no: EM13782345

Questions Cloud

Calculate the inventory carrying cost associated : Helter Industries, a company that produces a line of women's bathing suits, hires temporaries to help produce its summer product demand. For the current four-month rolling schedule, there are three temps on staff and 12 full-time employees. The temps..
The financial performance and condition of the organization : Choose three or four areas from your SWOT analysis and explain why the areas you have chosen are essential to your strategic plan.
Specify optimal strategy-expected profit that strategy : Entering international markets has become a priority for many companies even in the US, which has a large domestic market? Is having a strategic alliance with foreign companies a better alternative to simply appointing distributors and dealers abroad..
Where do you stand on this issue : Some courts hold that an engagement ring is a conditional gift that becomes an absolute (effective) gift only on marriage. Other courts conclude that when an engagement ring is given to the donee, the donee should have full ownership rights in the..
Define a static max method in the geometricobject class : Modify the GeometricObject class to implement the Comparable interface, and define a static max method in the GeometricObject class for finding the larger of two GeometricObject objects
Explore the effects of carters language on readers familiar : Explore the effects of Carter's language on readers familiar with other versions of the story. How do you respond to her representation of the father?
Ethical alternatives for resolving this dilemma : How might Irina's age and parents' involvement in the referral affect how Dr. Matthews can resolve the dilemma? How might the state law on treatment of minors and HIPAA rule on access of guardians to a minor's health care record influence Dr. Matt..
Barbara is considering investing in a stock and is aware tha : 1.) Barbara is considering investing in a stock and is aware that the return on that investment is particularly sensitive to how the economy is performing. Her analysis suggests that four states of the economy can affect the return on the investment...
Simply appointing distributors and dealers abroad : Entering international markets has become a priority for many companies even in the US, which has a large domestic market? Is having a strategic alliance with foreign companies a better alternative to simply appointing distributors and dealers abroad..

Reviews

Write a Review

JAVA Programming Questions & Answers

  Compare and contrast the safavid and ottoman empires

How did the creation of the Janissary system shape the development of the Ottoman Empire? What precipitated the decline of the Ottoman Empire? Compare and contrast the Safavid and Ottoman empires?

  Write a program to store in a 2-d boolean array

Write a program to store in a 2-D boolean array of size 5 and 10 a true value if a random value is less than 0.5 else false. Print only the indexes of cells with true value.

  Create a website

The preplanning design consists of a document that defines the element specifically requested by the client and indicates where these features will be located on the Website

  Develop a web-based application the server-side part of

develop a web-based application. the server-side part of the application must be developed using java servlets

  Implement a class person with two fields name

Implement a class Person with two fields name and age, and a class Car with three fields - implement a class that saves the details of the person.

  Marketing necessary for practice-hospital to successful

Why is marketing necessary for a practice or hospital to be successful? What considerations should be taken into account when marketing health care services or products? (Hint think about all the medication ads you seen on tv or in magazines)

  Create a frame and set its layout to flowlayout

Create a frame and set its layout to FlowLayout, create two panels and add them to the frame and Each panel contains three buttons. The panel uses FlowLayout.

  User to input a decimal number and ouputs the number

Write a program that prompts the user to input a decimal number and ouputs the number rounded to the nearest integer.Remember the rules around proper development style and form, including adding comments. A software developer should always add commen..

  Write a java program that creates three threads

The reader-writer problem can be stated as given: A shared memory location can be concurrently read by any number of tasks, but when a task must write to the shared memory location, it must have exclusive access.

  Requests 2 numbers from the user and then passes

Write a program in java that requests 2 numbers from the user and then passes these 2 numbers to a method findMax that displays the largest number. Make sure your method is called fron main(). Test the method by passing various data to it

  Demonstrating your understanding of java collections

Design, write and test the Java program ReadStoreShow.java with the following requirements:

  Complete the code to counts the number of lines input

Complete the code to counts the number of lines input by a user until the user enters the string ENDOFDATA (must be uppercase letters, no spaces) on a line by itself.

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