Self mailing boxes py
Here is a simple Python script that generates a self-mailing box design:
class SelfMailBox:
def __init__(self, width, height, depth):
self.width = width
self.height = height
self.depth = depth
def calculate_surface_area(self):
return 2 * (self.width * self.height + self.height * self.depth + self.width * self.depth)
def calculate_volume(self):
return self.width * self.height * self.depth
def print_details(self):
print(f"Width: {self.width} cm")
print(f"Height: {self.height} cm")
print(f"Depth: {self.depth} cm")
print(f"Surface Area: {self.calculate_surface_area()} cm^2")
print(f"Volume: {self.calculate_volume()} cm^3")
# Example usage:
box = SelfMailBox(10, 5, 3)
box.print_details()
This script defines a SelfMailBox
class with attributes for the width, height, and depth of the box. It also includes methods to calculate the surface area and volume of the box, as well as a method to print out the details of the box.
In the example usage, we create a SelfMailBox
object with a width of 10 cm, a height of 5 cm, and a depth of 3 cm, and then print out its details.
Note that this script does not actually generate a physical self-mailing box, but rather provides a simple mathematical model of one.