import math class Calculator: #Calculator class X=0 y=0 answer = 0 def __init__(self, x=0, y=0): #the constructor self.x

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899604
Joined: Mon Aug 02, 2021 8:13 am

import math class Calculator: #Calculator class X=0 y=0 answer = 0 def __init__(self, x=0, y=0): #the constructor self.x

Post by answerhappygod »

Import Math Class Calculator Calculator Class X 0 Y 0 Answer 0 Def Init Self X 0 Y 0 The Constructor Self X 1
Import Math Class Calculator Calculator Class X 0 Y 0 Answer 0 Def Init Self X 0 Y 0 The Constructor Self X 1 (268.71 KiB) Viewed 59 times
help me create GUI for this using tkinter in python please.
import math class Calculator: #Calculator class X=0 y=0 answer = 0 def __init__(self, x=0, y=0): #the constructor self.x = x self.y = y def get_x(self): #getter for x return self._x def set_x(self, x): #setter for x self._X = int(x) def get_y(self): #getter for y return self._y def set_y(self, y): #setter for y self._Y = int(y) def display(self): #displaying the menu print("MENU") print("1. Addition") print("2. Subtraction") print("3. Multiplication") print("4. Division") print("5. SquareRoot") print("6. Power") print("0. Exit") def Addition(self): #Addition method self.answer = self.get_x() + self.get_y() return self.answer def Subtraction(self): #Subtraction method self.answer = self.get_x() self.get_y() return self.answer def Multiplication(self): #Multiplication method self.answer = self.get_x() * self.get_y() return self.answer def Division(self): #Division method self.answer = self.get_x() / self.get_y() return self.answer def SquareRoot(self): #SquareRoot method self.answer = math.sqrt(self.get_x() return self.answer def Power(self): #Power method self.answer = math.pow(self.get_x(), self.get_y()) return self.answer
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply