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
When comparing alternative methods for making information systems identification and selection decisions, top management's selec
Softa [21]

Answer: b) False

Explanation:

Alternative method that is used for information system consisting of prototyping, outsourcing, end-user development mechanism, system life cycle etc for building a system.

  • These process consist of focusing on user requirement, using high level programming languages, development of prototype,creation of package, database etc instead of cross-sectional phase,selection decisions,top management option etc.
  • Therefore, the correct option is option(b) as the statement is false.
3 0
3 years ago
A spreadsheet program is a computerized version of
MrRa [10]

Answer:

A spreadsheet program is a computerized version of paper accounting.

Explanation:

A spreadsheet program is a computerized version of a paper accounting worksheet where everyone can easily use the sheet according to their need. For example, a spreadsheet can be used as a data entry sheet, as arithmetic operations. Data entry in paper accounting was done manually with paper whereas spreadsheet has cells in it to record the entries. Similarly, other operations such as recording the data, performing analytical operations were part of old system and these are now used in spreadsheet as a basic function.  In short, the spreadsheet is a very friendly application where values can be analyzed, stored, and modified as per requirements. These all defined tasks are part of paper based accounting now done using computer program.

7 0
3 years ago
Read 2 more answers
What occurs in a steam engine?
VARVARA [1.3K]
Fist one correct.
second wrong because not all heat is used for work, some of it lost to other.
third wrong because fuel burn inside is called combustion engine
 <span />
7 0
3 years ago
Read 2 more answers
Robert’s computer is not working properly. It has become too slow to respond to programs. What can he do to maintain his compute
ozzi

Answer: Utility Software

Explanation:

Utility software is software designed to help to analyze, configure, optimize or maintain a computer. It is used to support the computer infrastructure - in contrast to application software, which is aimed at directly performing tasks that benefit ordinary users.

3 0
3 years ago
What is a command-line interactive scripting environment that provides the commands for almost any management task in a Windows
hoa [83]

Answer:

kqwbxskwsxe

Explanation:

menb dhj

8 0
3 years ago
Other questions:
  • What is intensity? this is for digital arts
    12·1 answer
  • A virtual private network (VPN) is used to securely connect to another network over a insecure network.
    9·2 answers
  • If Chris has a car liability insurance, what damage would he be covered for
    10·1 answer
  • A form letter can be customized by using different fields in a __________.
    15·2 answers
  • HELP!!! Bad things about Helen Keller. I'm doing a debate and i need to prove that Steve Jobs is better than Helen Keller!!
    14·1 answer
  • 2. ¿Cuáles de los siguientes Software son lenguajes de Programación?
    10·1 answer
  • First time using this site so be mindful if I make any mistakes
    6·1 answer
  • Dash transfers several bits of data together at one time<br>​
    6·1 answer
  • What is the appropriate source to find information about an organization?
    12·1 answer
  • A hub is a central computer true or false?
    13·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!