RKL Final
RKL Final
1
HSBPVT’S Parikrama Polytechnic Kashti
CERTIFICATE
Date:-
Place:-
2
INDEX
1 Aim 4
2 Course Outcome 4
3 Introduction 5
4 Algorithm 6
5 Flowchart 7
6 Program Code 8
7 Output 18
8 Resource Used 19
9 Conclusion 20
10 Reference 21
3
Aim:-
Mini Calculator
Course Outcome:-
Analyze the functional block of 8086 microprocessor.
Write assembly language program for the given problem.
Use instructions for different addressing modes.
4
Introduction:- A microprocessor is an important part of a computer
architecture without which you will not able to perform anything on your
computer. It is a programmable device that takes in input performs some
arithmetic and logical operations over it and produces the desired output. In
simple words, a microprocessor is a digital device on a chip that can fetch
instructions from memory, decode and excute them and give results.Mini
calculators are compact, handheld devices designed for basic arithmetic
calculations. These devices offer convenience and simplicity for everyday
mathematical tasks, making them popular among students, professionals, and
individuals needing quick calculations on the go. Mini calculators are simple
devices designed to perform basic arithmetic calculations quickly and
efficiently. Behind their seemingly straightforward functionality lies a robust
algorithm that enables them to carry out operations such as addition,
subtraction, multiplication, and division. This report delves into the algorithmic
aspects of mini calculators, providing insights into how these devices process
mathematical operations.
5
Algorithm:-
1. Input: The algorithm begins by receiving input from the user, which
includes numerical values and the desired operation (addition,
subtraction, multiplication, or division).
2. Parsing Input: The input is parsed to extract the numerical values and
identify the operation to be performed.
zero.
6
and logarithms, requiring more complex algorithms for computation.
FlowChart:-
7
Program Code:-
from tkinter import *
import tkinter.messagebox
import math
root = Tk()
root.geometry("650x400+300+300")
switch = None
# Button on press
def btn1_clicked():
if disp.get() == '0':
disp.delete(0, END)
pos = len(disp.get())
disp.insert(pos, '1')
def btn2_clicked():
if disp.get() == '0':
disp.delete(0, END)
pos = len(disp.get())
disp.insert(pos, '2')
def btn3_clicked():
if disp.get() == '0':
disp.delete(0, END)
pos = len(disp.get())
disp.insert(pos, '3')
def btn4_clicked():
if disp.get() == '0':
disp.delete(0, END)
pos = len(disp.get())
disp.insert(pos, '4')
def btn5_clicked():
if disp.get() == '0':
disp.delete(0, END)
pos = len(disp.get())
disp.insert(pos, '5')
def btn6_clicked():
if disp.get() == '0':
disp.delete(0, END)
pos = len(disp.get())
8
disp.insert(pos, '6')
def btn7_clicked():
if disp.get() == '0':
disp.delete(0, END)
pos = len(disp.get())
disp.insert(pos, '7')
def btn8_clicked():
if disp.get() == '0':
disp.delete(0, END)
pos = len(disp.get())
disp.insert(pos, '8')
def btn9_clicked():
if disp.get() == '0':
disp.delete(0, END)
pos = len(disp.get())
disp.insert(pos, '9')
def btn0_clicked():
if disp.get() == '0':
disp.delete(0, END)
pos = len(disp.get())
disp.insert(pos, '0')
def key_event(*args):
if disp.get() == '0':
disp.delete(0, END)
def btnp_clicked():
pos = len(disp.get())
disp.insert(pos, '+')
def btnm_clicked():
pos = len(disp.get())
disp.insert(pos, '-')
def btnml_clicked():
pos = len(disp.get())
disp.insert(pos, '*')
def btnd_clicked():
pos = len(disp.get())
disp.insert(pos, '/')
def btnc_clicked(*args):
disp.delete(0, END)
disp.insert(0, '0')
9
def sin_clicked():
try:
ans = float(disp.get())
if switch is True:
ans = math.sin(math.radians(ans))
else:
ans = math.sin(ans)
disp.delete(0, END)
disp.insert(0, str(ans))
except Exception:
tkinter.messagebox.showerror("Value Error", "Check your values and ope
rators")
def cos_clicked():
try:
ans = float(disp.get())
if switch is True:
ans = math.cos(math.radians(ans))
else:
ans = math.cos(ans)
disp.delete(0, END)
disp.insert(0, str(ans))
except Exception: tkinter.messagebox.showerror("Value Error", "Check your
values and ope
rators")
def tan_clicked():
try:
ans = float(disp.get())
if switch is True:
ans = math.tan(math.radians(ans))
else:
ans = math.tan(ans)
disp.delete(0, END)
disp.insert(0, str(ans))
except Exception:
tkinter.messagebox.showerror("Value Error", "Check your values and ope
rators")
def arcsin_clicked():
try:
ans = float(disp.get())
if switch is True:
ans = math.degrees(math.asin(ans))
else:
ans = math.asin(ans)
disp.delete(0, END)
10
disp.insert(0, str(ans))
except Exception:
tkinter.messagebox.showerror("Value Error", "Check your values and ope
rators")
def arccos_clicked():
try:
ans = float(disp.get())
if switch is True:
ans = math.degrees(math.acos(ans))
else:
ans = math.acos(ans)
disp.delete(0, END)
disp.insert(0, str(ans))
except Exception:
tkinter.messagebox.showerror("Value Error", "Check your values and ope
rators")
def arctan_clicked():
try:
ans = float(disp.get())
if switch is True:
ans = math.degrees(math.atan(ans))
else:
ans = math.atan(ans)
disp.delete(0, END)
disp.insert(0, str(ans))
except Exception:
tkinter.messagebox.showerror("Value Error", "Check your values and ope
rators")
def pow_clicked():
pos = len(disp.get())
disp.insert(pos, '**')
def round_clicked():
try:
ans = float(disp.get())
ans = round(ans)
disp.delete(0, END)
disp.insert(0, str(ans))
except Exception:
tkinter.messagebox.showerror("Value Error", "Check your values and ope
rators")
def logarithm_clicked():
try:
ans = float(disp.get())
11
ans = math.log10(ans)
disp.delete(0, END)
disp.insert(0, str(ans))
except Exception:
tkinter.messagebox.showerror("Value Error", "Check your values and ope
rators")
def fact_clicked():
try:
ans = float(disp.get())
ans = math.factorial(ans)
disp.delete(0, END)
disp.insert(0, str(ans))
except Exception:
tkinter.messagebox.showerror("Value Error", "Check your values and ope
rators")
def sqr_clicked():
try:
ans = float(disp.get())
ans = math.sqrt(ans)
disp.delete(0, END)
disp.insert(0, str(ans))
except Exception:
tkinter.messagebox.showerror("Value Error", "Check your values and ope
rators")
def dot_clicked():
pos = len(disp.get())
disp.insert(pos, '.')
def pi_clicked():
if disp.get() == '0':
disp.delete(0, END)
pos = len(disp.get())
disp.insert(pos, str(math.pi))
def e_clicked():
if disp.get() == '0':
disp.delete(0, END)
pos = len(disp.get())
disp.insert(pos, str(math.e))
def bl_clicked():
pos = len(disp.get())
disp.insert(pos, '(')
def br_clicked():
pos = len(disp.get())
12
disp.insert(pos, ')')
def del_clicked():
pos = len(disp.get())
display = str(disp.get())
if display == '':
disp.insert(0, '0')
elif display == ' ':
disp.insert(0, '0')
elif display == '0':
else:
disp.delete(0, END)
disp.insert(0, display[0:pos-1])
def conv_clicked():
global switch
if switch is None:
switch = True
conv_btn['text'] = "Deg"
else:
switch = None
conv_btn['text'] = "Rad"
def ln_clicked():
try:
ans = float(disp.get())
ans = math.log(ans)
disp.delete(0, END)
disp.insert(0, str(ans))
except Exception:
tkinter.messagebox.showerror("Value Error", "Check your values and ope
rators")
def mod_clicked():
pos = len(disp.get())
disp.insert(pos, '%')
def btneq_clicked(*args):
try:
ans = disp.get()
ans = eval(ans)
disp.delete(0, END)
disp.insert(0, ans)
except:
tkinter.messagebox.showerror("Value Error", "Check your values and ope
rators")
# Label
13
data = StringVar()
# Row 1 Buttons
14
=btn1_clicked, fg="white", bg="#333333")
btn1.pack(side=LEFT, expand=TRUE, fill=BOTH)
# Row 2 Buttons
btnrow2 = Frame(root)
btnrow2.pack(expand=TRUE, fill=BOTH)
15
btn5.pack(side=LEFT, expand=TRUE, fill=BOTH)
# Row 3 Buttons
btnrow3 = Frame(root)
btnrow3.pack(expand=TRUE, fill=BOTH)
16
d=btnml_clicked, fg="white", bg="#333333")
btnml.pack(side=LEFT, expand=TRUE, fill=BOTH)
# Row 4 Buttons
btnrow4 = Frame(root)
btnrow4.pack(expand=TRUE, fill=BOTH)
root.mainloop()
17
OutPut:-
18
Resource Used:-
Sr.no Names Of Component Qty
1. System Window 11
Ram 8GB
SSD 512GB
2. Software 8086
Emulator
Conclusion:-
19
In conclusion, the mini calculator serves as a compact and efficient tool for
performing basic arithmetic calculations. Through this report, we have explored
various aspects of the mini calculator, including its features, uses, algorithms,
and flowchart representation.
Reference:-
20
[1] AI Sweigart - Automate the Boring Stuff with Python, 2nd Edition: Practical
Programming for Total Beginners – 2015.
[2] Python GUI Programming with Tkinter: Develop Responsive and Powerful
GUI Applications with Tkinter – 2018.
[3] Python Crash Course by Eric Matthes: This book is an excellent resource for
beginners to Python programming. It covers fundamental concepts and includes
practical projects, such as building a basic calculator, which you can use as a
reference for your report.
21