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
Evgesh-ka [11]
3 years ago
10

. Write a toString method for this class. The method should return a string containing the base, height and area of the triangle

. b. Write an equals method for this class. The method should accept a Triangle object as an argument. It should return true if the argument object contains the same data as the calling object, or false otherwise. c. Write a greaterThan method for this class. The method should accept a Triangle object as an argument. It should return true if the argument object has an area that is greater than the area of the calling object, or false otherwise.
Computers and Technology
1 answer:
marta [7]3 years ago
7 0

Answer:

Check the explanation

Explanation:

Circle.java

public class Circle {

private double radius;

public Circle(double r) {

radius = r;

}

public double getArea() {

return Math.PI * radius * radius;

}

public double getRadius() {

return radius;

}

public String toString() {

String str;

str = "Radius: " + radius + "Area: " + getArea();

return str;

}

public boolean equals(Circle c) {

boolean status;

if (c.getRadius() == radius)

status = true;

else

status = false;

return status;

}

public boolean greaterThan(Circle c) {

boolean status;

if (c.getArea() > getArea())

status = true;

else

status = false;

return status;

}

}

I have created a class also to test this class below is the class: -

MainCircle.java

public class MainCircle {

public static void main(String args[]) {

Circle c = new Circle(2.5);

Circle c1 = new Circle(2.5);

Circle c2 = new Circle(4.5);

System.out.println(c);

System.out.println(c1);

System.out.println(c2);

System.out.println("Is c and c1 equal : "+c.equals(c1));

System.out.println("Is c2 greater than c1 : "+c1.greaterThan(c2));

}

}

Output: -

Radius: 2.5Area: 19.634954084936208

Radius: 2.5Area: 19.634954084936208

Radius: 4.5Area: 63.61725123519331

Is c and c1 equal : true

Is c2 greater than c1 : true

You might be interested in
Which of the following is the MOST important consideration when planning your budget?
nata0808 [166]
<span>Budget for fixed expenses before flexible expenses.</span>
5 0
3 years ago
Read 2 more answers
What is the worst case time complexity of insertion sort where position of the data to be inserted is calculated using binary se
laiz [17]

Answer:

O(n²)

Explanation:

The worse case time complexity of insertion sort using binary search for positioning of data would be O(n²).

This is due to the fact that there are quite a number of series of swapping operations that are needed to handle each insertion.

4 0
3 years ago
Q) Look at the code and determine the output
lutik1710 [3]

Answer:

B.

Explanation:

6 0
2 years ago
What technology is being used when you are sent an email saying you can track your package?
LuckyWell [14K]

The technology is being used when you are sent an email saying you can track your package is known to be a scan code.

<h3>What are code-scanning technology?</h3>

This is known to be called a barcode reader or simply say a barcode scanner.

It is seen as a kind of an optical scanner that tends to read printed barcodes, as well as be able to decode the data that are found in the barcode and transmit the data to a computer.

Hence, The technology is being used when you are sent an email saying you can track your package is known to be a scan code.

Learn more about scan code from

brainly.com/question/24937533

#SPJ1

4 0
2 years ago
Which factors have increased the need for the latest cybersecurity technologies?
coldgirl [10]

The factors have increased the need for the latest cybersecurity technologies are A. smaller targets, C. customized threats.

<h3>What are the cybersecurity?</h3>

Cybersecurity is the safety of internet-related structures which include hardware, software program and records from cyber threats. The exercise is utilized by people and organizations to defend towards unauthorized get admission to to records facilities and different automated structures.

Cyberattacks can goal a huge variety of sufferers from character customers to organizations or maybe governments. When focused on groups or different organizations, the hacker's aim is normally to get admission to touchy and precious enterprise resources, which include highbrow property (IP), client records or price details.

Read more about the cybersecurity technologies:

brainly.com/question/26260220

#SPJ1

7 0
2 years ago
Other questions:
  • Which of the following is another name for cinematographers? (Select all that apply). lighting specialists production manager di
    8·1 answer
  • A paradigm innovation occurs when:
    6·1 answer
  • If you are feeling fatigued or sleepy while driving _________________.
    13·2 answers
  • What are the two main components on the motherboard?
    12·2 answers
  • You can apply several different worksheet themes from which tab?
    10·2 answers
  • Question 4 of 20
    5·1 answer
  • Which external reference is formatted correctly?
    6·2 answers
  • 5 differences between a regular mouse and a gaming mouse​
    14·1 answer
  • How to unlock your iphone when you forgot the password?.
    15·1 answer
  • Question 2 of 10
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!