Skip to content

Anne55x9/Geometry

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Geometry

Exercise 12

Download or clonethe C# project Geometry. This exercise is about defining a new class yourself! In the project, there is a file called Geometry.cs, containing a definition of a class Geometry. However, the definition is empty…

We have to fill out the class definition. The requirements to the Geometry class are the following (use Google if you cannot remember basic Geometry ):

  • Given the two side lengths of a rectangle, calculate the perimeter of the rectangle
  • Given the two side lengths of a rectangle, calculate the area of the rectangle
  • Given the radius of a circle, calculate the area of the circle
  • Given the four angles of a polygon with four sides, determine if the polygon is a rectangle (what conditions must the angles fulfill?)

Given these requirement, your tasks are:

  1. Fill out the Geometry definition, such that all require-ments are fulfilled. This includes definition of instance fields (are any needed?), constructors and methods

  2. Make some test code that tests your Geometry class. That is, you should create a Geometry object, call the various methods, and check the results against manually calculated results

  3. If you have time left, try to extend the class definition with various interesting geometric methods. It is up to you to define requirements, etc..

NOTE: This is a fairly large and somewhat difficult exercise. Try to solve it in small steps – get a little bit to work, test it, and then proceed to the next little bit. Manage the complexity!

About

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • C# 100.0%