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
Package Newton’s method for approximating square roots (Case Study: Approximating Square Roots) in a function named newton. This
lutik1710 [3]
I’m confused what are you asking
7 0
3 years ago
This code snippet is intended to calculate the balance of an account after twenty years of gaining interest. Select the statemen
Firlakuza [10]

Answer:

The answer to this question is the "years--;".

Explanation:

In the given question code the if we define the years--; and the rate of interest in the code so this program will return a value for example if we give rate of interest or rate to value 5 then the output of the code is 26532.977051  because it returns the double that is a floating-point value.  So the missing code for this question is "years--;".

 

8 0
3 years ago
Question 17 (3 points)
Archy [21]

Answer:

#

Explanation:

6 0
3 years ago
How can you use the Address Book to address an email message? Use the drop-down menus to complete the sentences. 1. Type an emai
Delvig [45]

Answer:

1. AutoCorrect

2. Address book

Explanation:

stan bts ?

5 0
3 years ago
Read 2 more answers
What are the third generation of computer?​
balu736 [363]

The period of third generation was from 1965-1971. The computers of third generation used Integrated Circuits (ICs) in place of transistors. A single IC has many transistors, resistors, and capacitors along with the associated circuitry. The IC was invented by Jack Kilby.

3 0
3 years ago
Read 2 more answers
Other questions:
  • If you write a toString method to display the contents of an object, object1, for a class, Class1, then the following two statem
    14·1 answer
  • If a pilot is converting standard time to UTC time and is given the time 1730 UTC, what would EST be?
    8·2 answers
  • Why does a HTML seen to work even when its broken? why does the code sometimes turn pink?
    9·1 answer
  • Create a view named ItemOrder view. It consists of the TaskID, description, price, order number, order date, and quoted price fo
    8·1 answer
  • 99 points!!! What would happen to the document if the change “A” is pointing to was accepted? a. There would be no changes. b. “
    6·2 answers
  • Characteristics of successful entrepreneurs include
    11·1 answer
  • the mail merge feature can be used to address the same letter to several different people , true or false
    13·2 answers
  • You open a folder Properties box to encrypt the folder, click Advanced, and discover that Encrypt contents to secure data is dim
    10·1 answer
  • Need help asap please​
    13·1 answer
  • Any anime weebs wanna talk
    7·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!