1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Inga [223]
3 years ago
9

Homework Assignment 2 1. Consider the skeletal definition for a class called circle given as: public class Circle { private int

radius; private Location location; private String = name; … } Override the equals and hashCode methods of the Object class for the Circle class. Assume that two circles are considered to be equal if they have the same radius and location (i.e. name field does not matter). Further assume that the Location class has overridden the hashCode method of the Object class. 2. Answer questions 12.35, 12.36, and 12.37 in the BlueJ text. 3. For the Date class provided with this assignment (Note: this is a BlueJ project) , implement the Comparable interface for the Date class. A date is considered less than another date if it comes before it in time.
Computers and Technology
1 answer:
jek_recluse [69]3 years ago
3 0

Answer:

See explaination

Explanation:

public class Circle {

private double radius;

private Location location;

private String name;

/* (non-Javadoc)

* atsee java.lang.Object#hashCode()

*/

atOverride

public int hashCode() {

final int prime = 31;

int result = 1;

result = prime * result + ((location == null) ? 0 : location.hashCode());

long temp;

temp = Double.doubleToLongBits(radius);

result = prime * result + (int) (temp ^ (temp >>> 32));

return result;

}

/* (non-Javadoc)

* atsee java.lang.Object#equals(java.lang.Object)

*/

atOverride

public boolean equals(Object obj) {

if (this == obj)

return true;

if (obj == null)

return false;

if (getClass() != obj.getClass())

return false;

Circle other = (Circle) obj;

if (location == null) {

if (other.location != null)

return false;

} else if (!location.equals(other.location))

return false;

if (Double.doubleToLongBits(radius) != Double.doubleToLongBits(other.radius))

return false;

return true;

}

NOTE: Replace all the "at" within the program with the at symbol ie shift 2.

You might be interested in
You can use the ____ to change the order of the wat windows are stacked.
djyliett [7]

Answer:

A

Explanation:

6 0
3 years ago
Decimal numbers are based on __________.
MaRussiya [10]
They are based on 10 digits.

I’m not sure.
8 0
3 years ago
Read 2 more answers
____ is (are) the abuse of e-mail systems to send unsolicited e-mail to large numbers of people.
Volgvan
Pretty sure answer is <span>E-mail spam</span>
4 0
3 years ago
Free wifi is typically offered on _ network
Marina CMI [18]

Free Wi-Fi is typically offered on public network

8 0
3 years ago
Read 2 more answers
Which function does the Subtotal feature use?
Marrrta [24]

The subtotal feature is a function of Microsoft Excel that returns the subtotal of the numbers in a database or column in a list. In addition, subtotal feature is categorized as a mathematical or trigonometrical function and it can also be used as a worksheet function in Excel.

8 0
3 years ago
Read 2 more answers
Other questions:
  • What will happen with communication methods in five years?
    8·1 answer
  • Which mistakes are NOT highlighted by the spell checker in a word-processing document?
    15·2 answers
  • If a user would like to modify margins to specific settings, users would need to select the _____ option.
    7·1 answer
  • computer has a 32-bit instruction word broken into fields as follows: opcode, six bits; two register file address fields, five b
    11·1 answer
  • Consider a network of 8 routers connected together to provide more than one path of connectivity between host A and host B at tw
    8·1 answer
  • Mario makes a check payable to "cash," intending to withdraw money from his bank. Kirby takes the check from Mario's notebook an
    10·2 answers
  • Free wifi is typically offered on an <br> a) unencrypted<br> b) encrypted<br> c) open<br> d) private
    14·2 answers
  • ______ is a customer-facing CRM application.<br><br> FAQ<br><br> Search<br><br> SFA<br><br> E-mail
    6·1 answer
  • Please help me.
    8·2 answers
  • when demonstrating 2022 altima’s parking assistance, what steering feature should you mention when pointing out how easy the veh
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!