Skip to content

Commit a73c3f1

Browse files
update:feature: more classes and methods and documentations add.
More vision of the project, classes updated, methods updated.
1 parent 56d515c commit a73c3f1

File tree

1 file changed

+255
-0
lines changed

1 file changed

+255
-0
lines changed

advanced_calculator.py

+255
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,14 @@
1+
# This is like making a package.lock file for npm package.
2+
# Yes, I should be making it.
3+
__author__ = "Nitkarsh Chourasia"
4+
__version__ = "0.0.0" # SemVer # Understand more about it
5+
__license__ = "MIT" # Understand more about it
6+
# Want to make it open source but how to do it?
17
# Program to make a simple calculator
8+
# Will have to extensively work on Jarvis and local_document and MongoDb and Redis and JavaScript and CSS and DOM manipulation to understand it.
9+
# Will have to study maths to understand it more better.
10+
# How can I market gtts? Like showing used google's api? This is how can I market it?
11+
# Project description? What will be the project description?
212

313
from numbers import Number
414
from sys import exit
@@ -12,6 +22,8 @@
1222
import date
1323

1424

25+
# Find the best of best extensions for the auto generation of the documentation parts.
26+
# For your favourite languages like JavaScript, Python ,etc,...
1527
# Should be able to print date and time too.
1628
# Should use voice assistant for specially abled people.
1729
# A fully personalised calculator.
@@ -26,39 +38,172 @@ def __init__(self):
2638
self.take_inputs()
2739

2840
def add(self):
41+
"""summary: Get the sum of numbers
42+
43+
Returns:
44+
_type_: _description_
45+
"""
2946
return self.num1 + self.num2
3047

3148
def sub(self):
49+
"""_summary_: Get the difference of numbers
50+
51+
Returns:
52+
_type_: _description_
53+
"""
3254
return self.num1 - self.num2
3355

3456
def multi(self):
57+
"""_summary_: Get the product of numbers
58+
59+
Returns:
60+
_type_: _description_
61+
"""
3562
return self.num1 * self.num2
3663

3764
def div(self):
65+
"""_summary_: Get the quotient of numbers
66+
67+
Returns:
68+
_type_: _description_
69+
"""
70+
# What do we mean by quotient?
3871
return self.num1 / self.num2
3972

4073
def power(self):
74+
"""_summary_: Get the power of numbers
75+
76+
Returns:
77+
_type_: _description_
78+
"""
4179
return self.num1**self.num2
4280

4381
def root(self):
82+
"""_summary_: Get the root of numbers
83+
84+
Returns:
85+
_type_: _description_
86+
"""
4487
return self.num1 ** (1 / self.num2)
4588

4689
def remainer(self):
90+
"""_summary_: Get the remainder of numbers
91+
92+
Returns:
93+
_type_: _description_
94+
"""
95+
96+
# Do I have to use the '.' period or full_stop in the numbers?
4797
return self.num1 % self.num2
4898

4999
def cube_root(self):
100+
"""_summary_: Get the cube root of numbers
101+
102+
Returns:
103+
_type_: _description_
104+
"""
50105
return self.num1 ** (1 / 3)
51106

52107
def cube_exponent(self):
108+
"""_summary_: Get the cube exponent of numbers
109+
110+
Returns:
111+
_type_: _description_
112+
"""
53113
return self.num1**3
54114

55115
def square_root(self):
116+
"""_summary_: Get the square root of numbers
117+
118+
Returns:
119+
_type_: _description_
120+
"""
56121
return self.num1 ** (1 / 2)
57122

58123
def square_exponent(self):
124+
"""_summary_: Get the square exponent of numbers
125+
126+
Returns:
127+
_type_: _description_
128+
"""
59129
return self.num1**2
60130

131+
def factorial(self):
132+
"""_summary_: Get the factorial of numbers"""
133+
pass
134+
135+
def list_factors(self):
136+
"""_summary_: Get the list of factors of numbers"""
137+
pass
138+
139+
def factorial(self):
140+
for i in range(1, self.num + 1):
141+
self.factorial = self.factorial * i # is this right?
142+
143+
def LCM(self):
144+
"""_summary_: Get the LCM of numbers"""
145+
pass
146+
147+
def HCF(self):
148+
"""_summary_: Get the HCF of numbers"""
149+
pass
150+
151+
# class time: # Working with days calculator
152+
def age_calculator(self):
153+
"""_summary_: Get the age of the user"""
154+
# This is be very accurate and precise it should include proper leap year and last birthday till now every detail.
155+
# Should show the preciseness in seconds when called.
156+
pass
157+
158+
def days_calculator(self):
159+
"""_summary_: Get the days between two dates"""
160+
pass
161+
162+
def leap_year(self):
163+
"""_summary_: Get the leap year of the user"""
164+
pass
165+
166+
def perimeter(self):
167+
"""_summary_: Get the perimeter of the user"""
168+
pass
169+
170+
class Trigonometry:
171+
"""_summary_: Class enriched with all the methods to solve basic trignometric problems"""
172+
173+
def pythagorean_theorem(self):
174+
"""_summary_: Get the pythagorean theorem of the user"""
175+
pass
176+
177+
def find_hypotenuse(self):
178+
"""_summary_: Get the hypotenuse of the user"""
179+
pass
180+
181+
def find_base(self):
182+
"""_summary_: Get the base of the user"""
183+
pass
184+
185+
def find_perpendicular(self):
186+
"""_summary_: Get the perpendicular of the user"""
187+
pass
188+
189+
# class Logarithms:
190+
# Learn more about Maths in general
191+
192+
def quadratic_equation(self):
193+
"""_summary_: Get the quadratic equation of the user"""
194+
pass
195+
196+
def open_system_calculator(self):
197+
"""_summary_: Open the calculator present on the machine of the user"""
198+
# first identify the os
199+
# track the calculator
200+
# add a debugging feature like error handling
201+
# for linux and mac
202+
# if no such found then print a message to the user that sorry dear it wasn't possible to so
203+
# then open it
204+
61205
def take_inputs(self):
206+
"""_summary_: Take the inputs from the user in proper sucession"""
62207
while True:
63208
while True:
64209
try:
@@ -76,6 +221,7 @@ def take_inputs(self):
76221
# exit() # Some how I need to exit it
77222

78223
def greeting(self):
224+
"""_summary_: Greet the user with using Audio"""
79225
text_to_audio = "Welcome To The Calculator"
80226
self.gtts_object = gTTS(text=text_to_audio, lang="en", tld="co.in", slow=False)
81227
tts = self.gtts_object
@@ -90,6 +236,7 @@ def greeting(self):
90236

91237
# Here OOP is not followed.
92238
def user_name(self):
239+
"""_summary_: Get the name of the user and have an option to greet him/her"""
93240
self.name = input("Please enter your good name: ")
94241
# Making validation checks here
95242
text_to_audio = "{self.name}"
@@ -105,6 +252,12 @@ def user_name(self):
105252
time.Clock().tick(10)
106253

107254
def user_name_art(self):
255+
"""_summary_: Get the name of the user and have an option to show him his user name in art"""
256+
# Default is to show = True, else False if user tries to disable it.
257+
258+
# Tell him to show the time and date
259+
# print(art.text2art(self.name))
260+
# print(date and time of now)
108261
# Remove whitespaces from beginning and end
109262
# Remove middle name and last name
110263
# Remove special characters
@@ -122,6 +275,99 @@ def user_name_art(self):
122275
# Remove numbers
123276
# Remove everything
124277

278+
class unitConversion:
279+
"""_summary_: Class enriched with all the methods to convert units"""
280+
281+
# Do we full-stops in generating documentations?
282+
283+
def __init__(self):
284+
"""_summary_: Initialise the class with the required attributes"""
285+
self.take_inputs()
286+
287+
def length(self):
288+
"""_summary_: Convert length units"""
289+
# It should have a meter to unit and unit to meter converter
290+
# Othe lengths units it should also have.
291+
# Like cm to pico meter and what not
292+
pass
293+
294+
def area(self):
295+
# This will to have multiple shapes and polygons to it to improve it's area.
296+
# This will to have multiple shapes and polygons to it to improve it's area.
297+
# I will try to use the best of the formula to do it like the n number of polygons to be solved.
298+
299+
pass
300+
301+
def volume(self):
302+
# Different shapes and polygons to it to improve it's volume.
303+
pass
304+
305+
def mass(self):
306+
pass
307+
308+
def time(self):
309+
pass
310+
311+
def speed(self):
312+
pass
313+
314+
def temperature(self):
315+
pass
316+
317+
def data(self):
318+
pass
319+
320+
def pressure(self):
321+
pass
322+
323+
def energy(self):
324+
pass
325+
326+
def power(self):
327+
pass
328+
329+
def angle(self):
330+
pass
331+
332+
def force(self):
333+
pass
334+
335+
def frequency(self):
336+
pass
337+
338+
def take_inputs(self):
339+
pass
340+
341+
class CurrencyConverter:
342+
def __init__(self):
343+
self.take_inputs()
344+
345+
def take_inputs(self):
346+
pass
347+
348+
def convert(self):
349+
pass
350+
351+
class Commands:
352+
def __init__(self):
353+
self.take_inputs()
354+
355+
def previous_number(self):
356+
pass
357+
358+
def previous_operation(self):
359+
pass
360+
361+
def previous_result(self):
362+
pass
363+
364+
def clear_screen(self):
365+
# Do I need a clear screen?
366+
# os.system("cls" if os.name == "nt" else "clear")
367+
# os.system("cls")
368+
# os.system("clear")
369+
pass
370+
125371

126372
if __name__ == "__main__":
127373
operation_1 = Calculator(10, 5)
@@ -134,3 +380,12 @@ def user_name_art(self):
134380

135381

136382
# Let's explore colorma
383+
# Also user log ins, and it saves user data and preferences.
384+
# A feature of the least priority right now.
385+
386+
# List of features priority should be planned.
387+
388+
389+
# Documentations are good to read and understand.
390+
# A one stop solution is to stop and read the document.
391+
# It is much better and easier to understand.

0 commit comments

Comments
 (0)