-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
35 changed files
with
1,551 additions
and
251 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -135,4 +135,4 @@ dmypy.json | |
.pytype/ | ||
|
||
# Cython debug symbols | ||
cython_debug/ | ||
cython_debug/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
"""Circle modules | ||
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#module for calculate area & circumference circle | ||
|
||
class Circle: | ||
def __init__(self, radius, PI): | ||
self.r = radius | ||
self.PI = PI | ||
|
||
def Calculating_Area(self): | ||
global area | ||
area = self.PI * self.r ** 2 | ||
return area | ||
|
||
def Calculating_Circumference(self): | ||
global perimeter | ||
perimeter = 2 * self.PI * self.r | ||
return perimeter | ||
|
||
def Result(self): | ||
res = f"""\n | ||
---------------------------------------------- | ||
CALCULATE | ||
---------------------------------------------- | ||
Radius (r) = {self.r} cm | ||
Pi value (π) = {self.PI} | ||
Formula the circle circumference = 2 * π * r | ||
= 2 * {self.PI} * {self.r} cm | ||
Formula the circle area = π * r^2 | ||
= {self.PI} * ({self.r})^2 cm | ||
--------------------RESULT-------------------- | ||
Circle circumference = {perimeter} cm | ||
Circle area = {area} cm^2 | ||
""" | ||
return res |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# module for execute area & circumference circle | ||
from modules.clearscreen import clear | ||
from modules.PlaneGeometry.Circle.calculate import Circle | ||
from modules.banners import circle_banner | ||
from modules.PlaneGeometry.Circle.wannaquit import MainQuestion | ||
from rich import print | ||
|
||
def Execute_Circle(): | ||
clear() | ||
circle_banner() | ||
print("Calculate area and circumference of the circle") | ||
#initiating | ||
def Input_radius(): #input side length | ||
try: | ||
global radius | ||
radius = float(input("\nEnter radius length (r) = ")) | ||
if radius <= 0:print("[red][ERROR][/red] Invalid value. The value must greater than 0 !");Input_radius() | ||
except ValueError: | ||
print("[red][ERROR][/red] Value error. Enter again !") | ||
Input_radius() | ||
except KeyboardInterrupt: | ||
print("\n\nThank you for using Geometry Calc :)") | ||
exit() | ||
Input_radius() | ||
def Input_pi(): | ||
try: | ||
global PI | ||
# select pi value | ||
select_pi = input("\nUsing pi (π) default value : 3.14 ? [y/n] = ") | ||
if select_pi == 'y':PI = 3.14 # set default pi value to 3.14 | ||
elif select_pi == 'n': | ||
print("""\n\n[green][NOTE][/green] pi value must 3.14. But, you can custom decimal value of pi. | ||
Example : 3.14159""") | ||
PI = float(input("\nEnter custom pi value (π) = ")) | ||
else:print("\n[red][ERROR][/red] Please enter correctly");Input_pi() | ||
except KeyboardInterrupt: | ||
print("\n\nThank you for using Geometry Calc :)") | ||
exit() | ||
Input_pi() | ||
ExecCircle = Circle(radius,PI) | ||
ExecCircle.Calculating_Area();ExecCircle.Calculating_Circumference() | ||
result = ExecCircle.Result();print(result) | ||
MainQuestion() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
from modules.clearscreen import clear | ||
from rich import print | ||
|
||
def MainQuestion(): | ||
print(""" | ||
________________________________________________ | ||
What you want to do ? | ||
1. Count again | ||
2. Go to the previous menu | ||
99. Exit | ||
""") | ||
def question(): | ||
try: | ||
select = int(input("Select : ")) | ||
if select == 1: | ||
from modules.PlaneGeometry.Circle.execute import Execute_Circle | ||
Execute_Circle() | ||
elif select == 2: | ||
print("Press [blue]<enter>[/blue] to continue") | ||
input() | ||
elif select == 99: | ||
print("\n\nThank you for using Geometry Calc :)") | ||
exit() | ||
else: | ||
print("[red][ERROR][/red] Invalid input. Enter again !") | ||
question() | ||
except ValueError: | ||
print("[red][ERROR][/red] Value error. Enter again !") | ||
question() | ||
except KeyboardInterrupt: | ||
print("\n\nThank you for using Geometry Calc :)") | ||
exit() | ||
question() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
"" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#parallelogram | ||
|
||
class Parallelogram: | ||
def __init__(self, base, height): | ||
self.b = base | ||
self.h = height | ||
|
||
def Calculating_Area(self): | ||
global area | ||
area = self.b * self.h | ||
return area | ||
|
||
def Calculating_Perimeter(self): | ||
global perimeter | ||
perimeter = 2 * (self.b + self.h) | ||
return perimeter | ||
|
||
def Result(self): | ||
res = f"""\n | ||
---------------------------------------------- | ||
CALCULATE | ||
---------------------------------------------- | ||
Base (b) = {self.b} cm | ||
Height (h) = {self.h} cm | ||
Formula the parallelogram | ||
perimeter = 2 (b + h) | ||
= 2 ({self.b} cm + {self.h} cm) | ||
Formula the parallelogram area = b * h | ||
= {self.b} cm * {self.h} cm | ||
--------------------RESULT-------------------- | ||
Parallelogram perimeter = {perimeter} cm | ||
Parallelogram area = {area} cm^2 | ||
""" | ||
return res |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# execute parralelogram | ||
from modules.clearscreen import clear | ||
from modules.PlaneGeometry.Parallelogram.calculate import Parallelogram | ||
from modules.banners import parallelogram_banner | ||
from modules.PlaneGeometry.Parallelogram.wannaquit import MainQuestion | ||
from rich import print | ||
|
||
def Execute_Parallelogram(): | ||
clear() | ||
parallelogram_banner() | ||
print("Calculate area and perimeter of the parallelogram") | ||
#initiating | ||
def Input_Base(): #input base length | ||
try: | ||
global Base | ||
Base = float(input("\nEnter base length (b) = ")) | ||
if Base <= 0:print("[red][ERROR][/red] Invalid value. The value must greater than 0 !");Input_Base() | ||
except ValueError: | ||
print("[red][ERROR][/red] Value error. Enter again !") | ||
Input_Base() | ||
except KeyboardInterrupt: | ||
print("\n\nThank you for using Geometry Calc :)") | ||
exit() | ||
Input_Base() #return to Input_Base() | ||
def Input_Height(): #input height length | ||
try: | ||
global Height | ||
Height = float(input("\nEnter height length (h) = ")) | ||
if Height <= 0:print("[red][ERROR][/red] Invalid value. The value must greater than 0 !");Input_Height() | ||
except ValueError: | ||
print("[red][ERROR][/red] Value error. Enter again !") | ||
Input_Height() | ||
except KeyboardInterrupt: | ||
print("\n\nThank you for using Geometry Calc :)") | ||
exit() | ||
Input_Height() #return to Input_Height() | ||
ExecParallelogram = Parallelogram(Base, Height) | ||
ExecParallelogram.Calculating_Area();ExecParallelogram.Calculating_Perimeter() | ||
result = ExecParallelogram.Result();print(result) | ||
MainQuestion() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
from modules.clearscreen import clear | ||
from rich import print | ||
|
||
def MainQuestion(): | ||
print(""" | ||
________________________________________________ | ||
What you want to do ? | ||
1. Count again | ||
2. Go to the previous menu | ||
99. Exit | ||
""") | ||
def question(): | ||
try: | ||
select = int(input("Select : ")) | ||
if select == 1: | ||
from modules.PlaneGeometry.Parallelogram.execute import Execute_Parallelogram | ||
Execute_Parallelogram() | ||
elif select == 2: | ||
print("Press [magenta]<enter>[/magenta] to continue") | ||
input() | ||
elif select == 99: | ||
print("\n\nThank you for using Geometry Calc :)") | ||
exit() | ||
else: | ||
print("[red][ERROR][/red] Invalid input. Enter again !") | ||
question() | ||
except ValueError: | ||
print("[red][ERROR][/red] Value error. Enter again !") | ||
question() | ||
except KeyboardInterrupt: | ||
print("\n\nThank you for using Geometry Calc :)") | ||
exit() | ||
question() |
Oops, something went wrong.