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
Microsoft acknowledged that if you type a res:// url (a microsoft-devised type of url) which is longer than ____ characters in i
cluponka [151]
Which is longer than 20 characters
5 0
3 years ago
A wireframe is a sketch detailing where text and images will be placed on a website. T/F
kirill115 [55]
Your answer would be true. 
3 0
3 years ago
When writing HTML code, what is meant by 'syntax'?​
aleksandrvk [35]

Answer:

   Syntax is essentially the punctuation and grammar rules for a computer language.

Explanation:

  Certain characters and words have special meanings and must appear in a particular order for the computer code to make any sense. A simple example from line 3 in Figure 2.2 is the piece of HTML code <head>.

8 0
2 years ago
Yuri is a skilled computer security expert who attempts to break into the systems belonging to his clients. He has permission fr
Tatiana [17]

Answer:

b) White-hat hacker

Explanation:

This is also called an ethical hacker. Unlike the other options, a white-hat hacker is a person specialized on computational security which offers services to organizations to test how safe they are from informatic attacks (viruses, theft of information, etc). This is carried out  based on a agreement between the whihte-hat hacker and the client via a contract.  

8 0
3 years ago
is a programming model that focuses on an application's components and data and methods the components use. Group of answer choi
ZanzabumX [31]

Object-oriented programming is a programming model that focuses on an application's components and data and methods the components use.

<h3>What is Object-oriented programming (OOP)?</h3>

This is known to be a form of  a programming paradigm that is known to be due to the idea of "objects", that often contain data and code.

Note that, Object-oriented programming is a programming model that focuses on an application's components and data and methods the components use.

Learn more about programming model from

brainly.com/question/22654163

#SPJ1

7 0
2 years ago
Other questions:
  • A modern information-processing model that views memories as emerging from particular activation patterns within neural networks
    6·1 answer
  • A network that is located in a small area, such as a single building is called a
    6·1 answer
  • PLEASE HELP SOMEONE!!!!!!!!! WILL GIVE BRAINLIEST!!!!!!!!!!!!!!!!!!!!!!!!! Fill in the blanks.
    15·1 answer
  • A network systems administrator would most likely help with
    13·2 answers
  • What are the process of boots up a computer?​
    15·2 answers
  • Where are my files shortcut in documents folder.
    14·1 answer
  • Use HTML and CSS, create a web page for the table shown below. Please copy (and paste) your code from your text editor (Replit).
    10·1 answer
  • What does the asterisk (*) after select tell the database to do in this query?
    6·1 answer
  • Alice is watching a speech over the internet. what type of message is alice attending to?
    10·1 answer
  • missy just hired a software development team to create an educational simulation app for a high school course. she has specific
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!