Triangle 2.0 (The name is a hint) Description: For  the task we’ll build a class representing a Rectangle. The tests for  this task will not check what’s

Triangle 2.0 (The name is a hint) Description:

For  the task we’ll build a class representing a Rectangle. The tests for  this task will not check what’s happening inside the class you create,  so it’s up to you as to what data members you use. The tests will also  assume you can write methods and constructors correctly. This means that you have to get the names, returns and parameters correct before the tests will even run.

Okay, now the task itself.

Your  company is doing some consulting work and the client has asked for a  new, more exciting version of their existing Triangle. They want a  Triangle, but with an extra side, which marketing are calling Triangle 2.0.

To meet the specification you need to create a class called Rectangle with the following methods:

  1. A no-parameter constructor that sets all side lengths to 1.
  2. A one parameter constructor that takes an int, and sets all side lengths to that value.
  3. A  two parameter constructor, that takes two ints, and sets two opposite  sides to one length, and the other pair of opposite sides to the other  length.
  4. A method getShortSide that takes no parameters and returns the length of the shortest side as an int.
  5. A method getLongSide that takes no parameters and returns the length of the longest side as an int.
  6. A method isSquare that takes no parameters and returns true if the rectangle is a square, and false otherwise.
  7. A method area that takes no parameters and returns the area of the rectangle as an int.
  8. A  method diagonal that takes no parameters and returns the length of the  diagonals as a double. The library function Math.sqrt(double) may be  useful here.
  9. A method bigger that takes a Rectangle as a  parameter and returns true if the current Rectangle has an area strictly  greater than the area of one given in the parameter.

You  don’t have to worry about not-right-angled quadrilaterals (so there’s  only squares and rectangles, no parallelograms, rhombi, trapezoids  etc.).

You also start with nothing in the scaffold. You will have  to create a suitable file for the class. The run button will assume that  Rectangle has a main method, but it’s not part of the tests, so you  don’t have to write it if you don’t care about it.

Share This Post

Email
WhatsApp
Facebook
Twitter
LinkedIn
Pinterest
Reddit

Order a Similar Paper and get 15% Discount on your First Order

Related Questions

This week, you will submit the second project, the Desktop Migration Proposal. Using the requirements analysis your manager provided and the Internet

This week, you will submit the second project, the Desktop Migration Proposal. Using the requirements analysis your manager provided and the Internet research you conducted, submit your recommendation to the assignment folder. As you are writing your recommendation, ensure your analysis and recommendations align with your manager’s priorities and concerns.

Comparing and contrasting space and time complexity in algorithm analysisWhen performing an algorithm analysis, **time complexity** and **space

Comparing and contrasting space and time complexity in algorithm analysisWhen performing an algorithm analysis, **time complexity** and **space complexity** are two of the most significant variables to consider. Although they both gauge an algorithm’s efficiency, they focus on distinct areas of performance.**Time complexity** is the relationship between an algorithm’s execution

Career Focus (Required/Graded) SubscribeThe CompTIA A+ certification demonstrates to employers that you have the knowledge, ability, and skills in

Career Focus (Required/Graded) SubscribeThe CompTIA A+ certification demonstrates to employers that you have the knowledge, ability, and skills in entry-level PC technology. Many industry insiders started with the CompTIA A+, and that led them to higher-paying, more complex jobs in both IT and cybersecurity. Many large corporations such as Apple, Cisco,

CompTIA’s T/S Methodology (Required/Graded) SubscribeFor this discussion, you will be assessing the following help desk ticket below from Chikako

CompTIA’s T/S Methodology (Required/Graded) SubscribeFor this discussion, you will be assessing the following help desk ticket below from Chikako (connectivity issue). Use the CompTIA 6-step troubleshooting process below to help figure out the connectivity issue. CompTIA 6-Step Troubleshooting Process: Identify the problem. Establish a theory of probable cause. Evaluate the theory

Accounting: Business and finance: computerscience: Economics: Marketing: Social Science Am a professional academic writer, content creator and, copywriter

Accounting: Business and finance: computerscience: Economics: Marketing: Social Science Am a professional academic writer, content creator and, copywriter with 7 years of research based experience.  My accounting: Business and finance: computerscience: Economics: Marketing: Social Science Am a professional academic writer, content creator and, copywriter with 7 years of research based

Explain why we cannot corrupt the output buffer of Buffovrflw_Demo4 through we can trigger a segmentation fault We cannot corrupt the output buffer of

Explain why we cannot corrupt the output buffer of Buffovrflw_Demo4 through we can trigger a segmentation fault We cannot corrupt the output buffer of `Buffovrflw_Demo4` because the program is likely designed with protections such as stack canaries, non-executable stack, or address space layout randomization (ASLR). These mechanisms prevent direct buffer