Using Python’s tkinter Graphical User Interface (GUI) module create a Python program to input the number of each type of coin a user has in their possession and then compute and display the total dollar and cents value of these coins. Your solution must accommodate Dollar, Half-Dollar, Quarter, Dime, Nickel, and Penny coins. Your solution must be robust against invalid inputs (i.e., negative value entered into any coin entry widget).
Please find the code below;;;
from tkinter import *
class Display() :
master = Tk();
e1 = Entry(master)
e2 = Entry(master)
e3 = Entry(master)
e4 = Entry(master)
e5 = Entry(master)
e6 = Entry(master)
result =Label(master, text="")
def __init__(self):
self.make_widgets();
def doCalculation(self):
number1 = 0;
total = 0
try :
number1 = int(self.e1.get());
number2 = int(self.e2.get());
number3 = int(self.e3.get());
number4 = int(self.e4.get());
number5 = int(self.e5.get());
number6 = int(self.e6.get());
if number1<0 or number2<0 or number3<0 or number4<0 or
number5<0 or number6<0 :
self.result.config(text = "Negative value not allowed")
return
totalCent = number1*100 +number2*50 +number3*25 +number4*10
+number5*5 +number6
dollarValue = totalCent//100;
cents = totalCent - dollarValue*100
self.result.config(text = "Dollar : "+str(dollarValue)+" Cents :
"+str(cents))
except:
self.result.config(text = "Error!!! Invalid number
entered!!!!!")
def make_widgets(self):
Label(self.master, text="Dollars : ").grid(row=0, column=0)
self.e1.grid(row=0, column=1)
Label(self.master, text="Half Dollars : ").grid(row=1,
column=0)
self.e2.grid(row=1, column=1)
Label(self.master, text="Quarter : ").grid(row=2, column=0)
self.e3.grid(row=2, column=1)
Label(self.master, text="Dime : ").grid(row=3, column=0)
self.e4.grid(row=3, column=1)
Label(self.master, text="Nickel : ").grid(row=4, column=0)
self.e5.grid(row=4, column=1)
Label(self.master, text="Penny : ").grid(row=5, column=0)
self.e6.grid(row=5, column=1)
Button(self.master, text='Calculate sum and
average',command=self.doCalculation).grid(row=6, column=0)
self.result.grid(row=6, column=1)
mainloop( )
#CALLING CLASS FOR MAIN
Display();
output:
Using Python’s tkinter Graphical User Interface (GUI) module create a Python program to input the number...
Create a GUI (Graphical User Interface) in Python to
graph the approximation of the Golden Spiral (Fibonacci
Spiral).
For this purpose, you must calculate the coordinates
and radio, and simulate a process of infinity using a loop.
In short, the graph must start in the lower left side
corner and continue to its center infinitely.
34 21 13
34 21 13
" In the workshop exercises you have used Python's Tkinter module to create simple Graphical User Interfaces. The following code is an incomplete Python program relying on Tkinter (with deliberately unhelpful variable and function names) which you must complete by filling in the blanks. When complete the program should create a window with two buttons, labelled and!!', respectively. When the button la belled'???' is pushed nothing happens. When the button labelled'!!"is pushed both buttons' labels are set to'!!!' from tkinter...
object oriented programming solve 2 quetions
9 Lab 8 - Graphical User Interface (GUI) The assignments for this week are to understand the use of tkinter modules to create GUI in Python. 9.1 Assignment 1 1. Create the following window using the tkinter module in Python. The button Quit closes the window, and the button Show prints the first name and last name entered in the Entry boxes. First Name Last Name Quit Show 2. Create the following window using...
REQUIREMENTS: Write a Graphical User Interface (GUI) program using JavaFX that prompts the user to enter a credit card number. Display whether the number is valid and the type of credit cards (i.e., Visa, MasterCard, American Express, Discover, and etc). The requirements for this assignment are listed below: • Create a class (CreditNumberValidator) that contains these methods: // Return true if the card number is valid. Boolean isValid(String cardNumber); // Get result from Step 2. int sumOfDoubleEvenPlace(String cardNumber); // Return...
Python
Consider the GUI below (3 Labels and 3 Radiobuttons) which has
been produced with a Python program using the Tkinter
library.
You are required to write a Python program to produce this
interactive GUI.
Your GUI must replicate the example above as closely as
possible, including the same widgets displayed in the sample
positions on the GUI, using the same colours, shapes and relative
sizes. (Note that the GUI border in the sample output does not need
to be...
python code( using functions please)! Rules of the game: - This game requires a dice. The goal of the game is to collect the correct number of coins to create a dollar. Players take coins based on a roll of the dice. The numbers on the dice correlate to the coin values as follows: 1—penny 2—nickel 3—dime 4—quarter 5— ( pick a random card from 1 to 4): o 1 = penny o 2 =...
I. User Interface Create a JavaFX application with a graphical user interface (GUI) based on the attached “GUI Mock-Up”. Write code to display each of the following screens in the GUI: A. A main screen, showing the following controls: • buttons for “Add”, “Modify”, “Delete”, “Search” for parts and products, and “Exit” • lists for parts and products • text boxes for searching for parts and products • title labels for parts, products, and the application title B. An add...
Write a program that tells what coins to give out for as change from 1 cent to 99 cents. Use coin denominations of 25 cents (quarters), 10 cents (dimes), and 1 cent (pennies) only. Include a loop that lets the user repeat this computation for new input values until the user says he or she wants to end the program. Solution Demo Hello I am the coin machine! I will give you the least number of coins for your change....
Write a MATLAB Graphical User Interface (GUI) to simulate and plot the projectile motion – the motion of an object projected into the air at an angle. The object flies in the air until the projectile returns to the horizontal axis (x-axis), where y=0. This MATLAB program should allow the user to try to hit a 2-m diameter target on the x-axis (y=0) by varying conditions, including the lunch direction, the speed of the lunch, the projectile’s size, and the...
C++ HW Question Your program will simulate a simple change maker for a vending machine. It will start with a stock of coins and dollars. It will then repeatedly request the price for an item to be purchased or to quit. If given a price, it will accept nickels, dimes, quarters, one-dollar and five-dollar bills—deposited one at a time—in payment. When the user has deposited enough to cover the cost of the item, the program will calculate the coins to...