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

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 passion for research, writing, and editin g makes me the perfect professional for varying topics in Studydaddy. I understand the value of detailed research

BYOD Registration Form Resources To complete this project, you may need to review instructions on how to take a screenshot.   Locate System

BYOD Registration Form Resources To complete this project, you may need to review instructions on how to take a screenshot.   Locate System Information Review this resource to check how to locate your system information.   Template Use the BYOD Ingest Form Template to complete the project. Delete the instructional text from the template before you submit.    2024 University of

Topic: Computer ScienceDistributed Database Management Systems (DDBMS), is the next generation of Database Management Systems, where the data is stored at

Topic: Computer ScienceDistributed Database Management Systems (DDBMS), is the next generation of Database Management Systems, where the data is stored at several geographical locations, but from the user or application perspective, it is still one Database. These are the advantages of this paradigm: enlarged availability and reliability of data, and

In this part, you are asked to explore and/or investigate distributed database management system (DDBMS). You can either explore the main concepts or

In this part, you are asked to explore and/or investigate distributed database management system (DDBMS). You can either explore the main concepts or technical challenges of DDBMS in general (without directly specifying a certain DBMS) or you can research a specific DBMS and present how it manages different aspects of distribution. Your exploration or

**Tutorial: Introduction to Graph Theory** **Category:** Computer Science **Details:** Graph theory is a foundational concept in computer science and

**Tutorial: Introduction to Graph Theory** **Category:** Computer Science **Details:** Graph theory is a foundational concept in computer science and mathematics, focusing on the study of graphs, which are structures consisting of nodes (vertices) and edges (connections between nodes). This tutorial provides a comprehensive introduction to graph theory, covering essential topics

Tunneling in VPN refers to securely transmitting data across the internet by encapsulating it within another packet, resulting in a “tunnel.” This process

Tunneling in VPN refers to securely transmitting data across the internet by encapsulating it within another packet, resulting in a “tunnel.” This process ensures privacy and security by preventing unauthorized access to data during transmission. Common tunneling protocols include PPTP, L2TP, and OpenVPN, which help to ensure data confidentiality and