Skip to content

Write a class definition for a Rectangle class that contains: Two int fields, length and width Mutator and accessor methods for the length and width fields. Ask the user for these values in the mutator methods. A Boolean method named isSquare that returns true if the rectangle’s length and width are the same and false otherwise. A method that re…

License

Notifications You must be signed in to change notification settings

bell-kevin/rectangle

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

rectangle

Write a class definition for a Rectangle class that contains:

-Two int fields, length and width
-Mutator and accessor methods for the length and width fields. Ask the user for these values in the mutator methods.
-A Boolean method named isSquare that returns true if the rectangle’s length and width are the same and false otherwise.
-A method that returns the perimeter of the rectangle
-A method that returns the area of the rectangle

Write a class definition for a Rectangle Driver class that tests all of the methods.

-Create a Rectangle object named paper.
-Use the mutator methods to assign user-input values for the length and width fields
-Use the Boolean method to determine if paper is a square.
+If it is a square, print “This paper is a square: ” and the square’s dimensions
+If it is not a square, print “This paper is a rectangle: ” and the rectangle’s dimensions
+Be sure to use the accessor methods to retrieve the dimensions for printing.
-Print out the rectangle’s perimeter and area

== We're Using GitHub Under Protest ==

This project is currently hosted on GitHub. This is not ideal; GitHub is a proprietary, trade-secret system that is not Free and Open Souce Software (FOSS). We are deeply concerned about using a proprietary system like GitHub to develop our FOSS project. I have a website where the project contributors are actively discussing how we can move away from GitHub in the long term. We urge you to read about the Give up GitHub campaign from the Software Freedom Conservancy to understand some of the reasons why GitHub is not a good place to host FOSS projects.

If you are a contributor who personally has already quit using GitHub, please email me for how to send us contributions without using GitHub directly.

Any use of this project's code by GitHub Copilot, past or present, is done without our permission. We do not consent to GitHub's use of this project's code in Copilot.

Logo of the GiveUpGitHub campaign

About

Write a class definition for a Rectangle class that contains: Two int fields, length and width Mutator and accessor methods for the length and width fields. Ask the user for these values in the mutator methods. A Boolean method named isSquare that returns true if the rectangle’s length and width are the same and false otherwise. A method that re…

Topics

Resources

License

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages