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
After pushing the power switch of the PC to the ʺonʺ position, Bob, the PC repair person, realizes that the power-on lights foun
Nana76 [90]

Answer:

<em>2. Logic</em>

<em></em>

Explanation:

We all know that for the PC to come on, there must be a power input, this means that if the PC does not power on, then there is probably no power input into the PC. <em>It is only logical for Bob to check if the PC is properly connected first when the power-on lights did not come on</em>. People with no technical training should be able to apply this simple logic too.

3 0
3 years ago
Which screen should be open to customize or personalize a desktop background?
stira [4]
Display Properties is the screen that should be open
5 0
3 years ago
Read 2 more answers
Jane wants to add a chart to her presentation so she’ll click the Insert tab and in the Images group, she’ll click the Chart but
kap26 [50]

(A. Stevie only) because You need to go the illustrations tab in order to click on the chart button.

Jane clicked on images tab so she was wrong.

Mark as brainlest plz :)

3 0
3 years ago
What type of address do computers use to find something on a network?
Leona [35]
An Internet Protocol address is a numerical label assigned to each device connected to a computer network that uses the Internet Protocol for communication. An IP address serves two main functions host or network interface identification and location addressing which can help you a lot.
6 0
3 years ago
File Account.java contains a definition for a simple bank account class with methods to withdraw, deposit, get the balance and a
puteri [66]

The answer & explanation for this question is given in the attachment below.

Download docx
5 0
3 years ago
Other questions:
  • Ill give Brainliest!!!!! I REALLYYY NEED HELP
    14·2 answers
  • _____ is a feature that records the changes you make to a document.
    12·1 answer
  • Use the image above to determine which toolbars will be displayed in the program you are using. SELECT ALL THAT APPLY
    11·2 answers
  • The narrative structure of the popular movies can be broken down into
    15·1 answer
  • What is the formula that calculates the session fee for members in excel
    13·1 answer
  • Two groups of simple machines and list the simple machines that belong in each group
    7·1 answer
  • ) Write a program to calculate the time to run 5 miles, 10 miles, half marathon, and full marathon if you can run at a constant
    12·1 answer
  • What validation type would you use to check that numbers fell within a certain range? a) range check b)presence check c)check di
    9·1 answer
  • Copying materials from a source text without using is<br> considered plagiarism<br> ?
    5·1 answer
  • Does anyone know the answer
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!