Software Development With Python
Software Development With Python
Introduction
Python is a versatile and powerful programming language that is well suited for software
development. It has gained popularity in recent years as a top choice if building a web
application, ML projects, data science projects, and more. The research study focused on the
creation of a different system with the help of “python programming language” in the pycharm
software platform. The research study includes the validation of the “minimum coin change
transaction system”, “Fourier series grapher system”, “discount system” and “library
management system”. The overall task is performed by the researcher with the help of
appropriate library functions in an effective manner.
Deliverable 1:
Task-1 Minimum-coin change for a transaction:
Introduction
The minimum coin change problem is a classic problem in computer science and algorithm. It
involves finding the minimum number of coins required to make changes to a given amount,
using a given set of coin denominations. The greedy algorithm works by building up a table of
minimum coin counts for each possible amount up to the target amount, starting with the base
case of zero coins need to make change for zero cents. It then iteratively fills in the table by
considering all the possible coin domination for each amount as well as choosing the minimum
number of coins required to make the changes. This algorithm assumes that the coin
denominations are distinct and sorted in ascending order. If the coin denominations are not
distinct or not sorted, the researcher needs to modify the algorithm accordingly.
Technical analysis
Figure 1: Code for “minimum coin change”
(Source: Created in Pycharn)
The code represents the creation of a “minimum coin change transaction system”. In this
implementation, coins are the list of coin denominations as well as the amount is the target
amount for which to make the change. The function returns the maximum number of coins that
are required to make the change for the target amount.
Figure 2: Code for “minimum coin change”
(Source: Created in Pycharn)
The code represents the creation of a “minimum coin change transaction system”. In order to use
this program, simply run it in any python environment such as pycharm that support Tkinter.
This program used a greedy algorithm to calculate the minimum number of coins needed for a
given transaction amount.
Figure 3: Output of “minimum coin change”
(Source: Created in Pycharn)
This is the output screen after executing the implemented code for creating the coin change
transaction system. The program will display a GUI with an input field for the transaction
amount, checkboxes for excluding coins, a button to calculate the minimum coin change, and a
text box to display the outcomes. Simply, enter the transaction amount and select which coin to
exclude. Here, the click button is used to see the minimum coin change.
The overall code is shown below:
import tkinter as tk
# Define the available coins
coins = [ 50, 10, 5, 2, 1]
# Define the GUI
root = tk.Tk()
root.title("Minimum Coin Change Program")
# Define the GUI elements
transaction_label = tk.Label(root, text="Transaction amount:")
transaction_entry = tk.Entry(root)
exclude_label = tk.Label(root, text="Exclude coins:")
exclude_checkboxes = [tk.Checkbutton(root, text=str(coin) + "p", variable=tk.BooleanVar())
for coin in coins[:-1]]
result_label = tk.Label(root, text="Result:")
result_text = tk.Text(root, height=10, width=30)
calculate_button = tk.Button(root, text="Calculate")
# Define the GUI layout
transaction_label.grid(row=0, column=0)
transaction_entry.grid(row=0, column=1)
exclude_label.grid(row=1, column=0)
for i, checkbox in enumerate(exclude_checkboxes):
checkbox.grid(row=1, column=i+1)
result_label.grid(row=2, column=0)
result_text.grid(row=2, column=1)
calculate_button.grid(row=3, column=1)
# Define the calculate function
def calculate():
# Get the transaction amount and excluded coins
transaction_amount = int(transaction_entry.get())
excluded_coins = [coin for coin, checkbox in zip(coins[:-1], exclude_checkboxes) if
checkbox.var.get()]
# Calculate the minimum coin change
remaining_amount = transaction_amount
coins_used = {}
for coin in coins:
if coin in excluded_coins:
continue
num_coins = remaining_amount // coin
if num_coins > 0:
coins_used[coin] = num_coins
remaining_amount -= coin * num_coins
if remaining_amount == 0:
break
# Display the minimum coin change
result_text.delete("1.0", tk.END)
result_text.insert("1.0", "\n".join([f"{coin}p: {coins_used[coin]}" for coin in coins_used]))
# Bind the calculate function to the calculate button
calculate_button.config(command=calculate)
# Run the GUI
root.mainloop()
Conclusion
The research creates the GUI interface after executing the implemented code for making the
change of coins based on a targeted amount. An input field for the transaction amount,
checkboxes for excluding coins, a button to determine the minimum coin change, and a text box
to display the results will all be displayed on the GUI that the software will display. Simply input
the transaction amount and choose the coin you want to ignore. The click button is utilized here
to display the smallest coin change.
Task-2 Fourier Series grapher
Introduction
Technical Analysis
Conclusion
def __str__(self):
return f"{self.name} ({self.member_type})"
class DiscountRate:
def __init__(self):
self.service_discounts = {
"Premium": 0.2,
"Gold": 0.15,
"Silver": 0.1,
}
self.product_discount = 0.1
class Visit:
def __init__(self, customer, service_cost, product_cost):
self.customer = customer
self.service_cost = service_cost
self.product_cost = product_cost
def getTotalCost(self):
discount_rate = DiscountRate()
service_discount = self.service_cost * discount_rate.getServiceDiscountRate(self.customer)
product_discount = self.product_cost *
discount_rate.getProductDiscountRate(self.customer)
total_cost = self.service_cost - service_discount + self.product_cost - product_discount
return total_cost
# Testing the classes
customer1 = Customer("User1", "Premium")
visit1 = Visit(customer1, 100, 50)
print(f"Total cost for {customer1}: £{visit1.getTotalCost():.2f}")
customer3 = Customer("User2")
visit3 = Visit(customer3, 120, 60)
print(f"Total cost for {customer3}: £{visit3.getTotalCost():.2f}")
Conclusion
Deliverable 2: Library Management System
Introduction
Software created to handle a library's many operations is known as a library management system
in Python. It typically has a number of features that enable the librarian to create, edit, and
examine the book's details, monitor book issues and returns, and control library users' accounts.
The researcher creates different types of pages that are needed to manage the library system.
Technical analysis
Part 1