From db095e828d63c0f6d080acfe76c05823f40df852 Mon Sep 17 00:00:00 2001 From: jdavilabeaz2401 Date: Wed, 26 Nov 2025 13:53:18 -0500 Subject: [PATCH] Added documantion and information to the programs --- circle1.py | 13 +++++++++++-- rectangle01.py | 11 ++++++++++- rectangular-solid01.py | 17 +++++++++++++++++ sphere1.py | 11 ++++++++++- 4 files changed, 48 insertions(+), 4 deletions(-) create mode 100644 rectangular-solid01.py diff --git a/circle1.py b/circle1.py index 0533a90..0ab12e5 100644 --- a/circle1.py +++ b/circle1.py @@ -1,3 +1,12 @@ +# Program circle1.py + +startUpMessage = ''' +This program calculates the area of a circle. + +''' + +print(startUpMessage) + import math PI = math.pi @@ -5,5 +14,5 @@ radius = float(input("Enter the radius of a circle ")) area = PI * radius**2 -print(f"The area is {area}") - +print(f"The area is {area:.2f}") +print("\n") diff --git a/rectangle01.py b/rectangle01.py index 2b1b70e..09f3373 100644 --- a/rectangle01.py +++ b/rectangle01.py @@ -1,7 +1,16 @@ +# Program rectangle01.py + +startUpMessage = ''' +This program calculates the area of a rectangle. + +''' + +print(startUpMessage) length = float(input("Enter a value for the length ")) width = float(input("Enter a value for the width ")) areaOfRectangle = length * width -print(f"Area = {areaOfRectangle:.1f}") \ No newline at end of file +print(f"Area = {areaOfRectangle:.1f}") +print("\n") \ No newline at end of file diff --git a/rectangular-solid01.py b/rectangular-solid01.py new file mode 100644 index 0000000..36a8ddd --- /dev/null +++ b/rectangular-solid01.py @@ -0,0 +1,17 @@ +# Program rectanglar-solid.py + +startUpMessage = ''' +This program calculates the volume of a rectangular solid. + +''' + +print(startUpMessage) + +length = float(input("Enter a value for the length ")) +width = float(input("Enter a value for the width ")) +height = float(input("Enter a value for the height ")) + +volumeOfRectangle = length * width * height + +print(f"Volume = {volumeOfRectangle:.1f}") +print("\n") diff --git a/sphere1.py b/sphere1.py index 4b110e9..8b59a6f 100644 --- a/sphere1.py +++ b/sphere1.py @@ -1,3 +1,12 @@ +# Program sphere1.py + +startUpMessage = ''' +This program calculates the volume of a sphere. + +''' + +print(startUpMessage) + import math PI = math.pi @@ -7,4 +16,4 @@ radius = float(input("Enter the radius of a sphere ")) volume = 4 / 3 * PI * radius**3 -print(f"The volume of the sphere is {volume}") +print(f"The volume of the sphere is {volume:.2f}")