Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 

Repository files navigation

📐 Polygon Area Calculator (Python OOP)

Python

A small geometry toolkit built with Python and OOP. It defines a Rectangle class and a Square class that inherits from it, with methods to compute area, perimeter, diagonal, draw the shape, and check how many shapes fit inside another.

🎯 Built to practice inheritance, method overriding, and class design.

✨ Features

  • Create Rectangle (width, height) and Square (side) objects
  • Compute area, perimeter, and diagonal
  • Modify dimensions via setter methods
  • Render shapes using * characters (get_picture)
  • Calculate how many shapes fit inside another (get_amount_inside)
  • Clean __str__ object representation

🧠 Concepts Practiced

Classes & Objects · Inheritance · Method Overriding · Math · String Formatting · Loops

🏗 Project Structure

Class / Method Description
Rectangle Base shape with width & height
Square(Rectangle) Inherits Rectangle, single side
get_area() / get_perimeter() Geometry calculations
get_diagonal() Pythagorean diagonal
get_picture() ASCII drawing of the shape
get_amount_inside(shape) Fits count of one shape in another

💻 How to Run

# Requires Python 3.8+
python polygon_calculator.py

🎯 Learning Outcome

  • Using inheritance in Python
  • Overriding methods in subclasses
  • Structuring programs around classes
  • Applying math formulas in code

📌 Future Improvements

  • Add Circle / Triangle classes
  • Unit tests with pytest
  • CLI to accept user dimensions

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages