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]
2 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]2 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
To create a formula in ___ you would first click in one of the cells. A.word b.excel c.facebook d.powerpoint
guajiro [1.7K]
The correct anwser is excel 
7 0
3 years ago
One of the disadvantages of Photoshop Express is that it does not have a Black and White effect. True False
Katarina [22]
False,
The Pop Color tool can be used to select one particular color, changing the rest of the image to black and white. The effects available in Photoshop Express don't allow for a huge amount of customization
8 0
3 years ago
HELP ASAP!Select all examples of desirable workplace skills, habits, and attitudes.
ddd [48]

Answer:

does not call in sick or miss work frequently

creates a list of solutions for the boss

arrives at work on time or early

waits for supervisor to give directions

works quickly and accurately

shows initiative

communicates effectively

sets clear goals to achieve success

Explanation:

Have a Great Day!!!

7 0
2 years ago
Steps to customize theme of desktop
Gnom [1K]

Answer:

Choose Start > Control Panel > Appearance and Personalization > Personalization. Right-click an empty area of the desktop and choose Personalize. Select a theme in the list as a starting point for creating a new one. Choose the desired settings for Desktop Background, Window Color, Sounds, and Screen Saver

Explanation:

4 0
2 years ago
Read 2 more answers
Please code in python and add comments to code
Gnoma [55]

#accepting input from user

n=int(input("Enter a number: "))

#entered number is stored in a temporary variable

temp=n

#initializng required variables

rev=0

dgt=0

#digits are reversed inside while loop

while(n>0):

dgt=n%10

rev=rev*10+dgt

n=n//10

#original number and its reverse are compared

if(temp==rev):

#if equal, it's a palindrome

print("It is a Palindrome")

else:

#if not equal, it's not a palindrome

print("It is not a Palindrome")

#◌⑅⃝●♡⋆♡Nåmřāthā♡⋆♡●⑅◌

4 0
2 years ago
Other questions:
  • What effect can camera tilt create? Do you think this is effective? Why or why not?
    13·1 answer
  • How do you make your graphics ADA accessible in BlueGriffon?
    12·2 answers
  • What arw two reasons for maintaning your privacy on the internet
    11·2 answers
  • Circular error are caused by adding the cell name of a/an cell to aformula
    7·1 answer
  • What is a orogram to block access to websites
    15·1 answer
  • Can some one help sorry I just so confused on this and I keep failing it I just need the help So choose the best answers
    12·1 answer
  • What is the definition of trouble shooting.
    12·1 answer
  • The _______ within a story are the people and/or objects that the story is about
    5·2 answers
  • How are digital and analog data similar? How are they different?
    15·1 answer
  • Mention and discuss specific professional ethics related to augmented reality, artificial intelligence, and the internet of thin
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!