#### Here is Your Sample Download Sample 📩

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***” and “**

*discount system***”. The overall task is performed by the researcher with the help of appropriate library functions in an effective manner.**

*library management system***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**

**Figure 4: Code for “Fourier Series Grapher”**

(Source: Created in Jupyter)

The code represents the creation of the “Fourier system’ in the jupyter notebook platform in “python programming language download” without the use of matpltlib function.

**Figure 5: Code for “Fourier Series Grapher”**

(Source: Created in Jupyter)

The code represents the creation of the “Fourier system’ in the jupyter notebook platform in “python programming language” without the use of the matpltlib function.

**Figure 6: Output of “Fourier Series Grapher”**

(Source: Created in Jupyter)

This is the outcome after the creation of the “Fourier system’ by implementing the executing code in the jupyter notebook platform in “python programming language download” without the use of the matpltlib function.

import numpy as np # Define the function to approximate with the Fourier Series def f(x): return np.abs(x) # Define the number of terms to include in the Fourier Series num_terms = 10 # Define the x values to plot x = np.linspace(-np.pi, np.pi, 1000) # Calculate the Fourier Series coefficients a0 = np.mean(f(x)) an = np.zeros(num_terms) bn = np.zeros(num_terms) for n in range(1, num_terms+1): an[n-1] = (2/np.pi) * np.trapz(f(x) * np.cos(n*x), x) bn[n-1] = (2/np.pi) * np.trapz(f(x) * np.sin(n*x), x) # Calculate the Fourier Series approximation f_approx = a0/2 for n in range(1, num_terms+1): f_approx += an[n-1] * np.cos(n*x) + bn[n-1] * np.sin(n*x) # Create a text file to save the plot data with open("fourier_data.txt", "w") as file: for i in range(len(x)): file.write(f"{x[i]}\t{f(x[i])}\t{f_approx[i]}\n") # Alternatively, you could directly plot the data using the following code: # for i in range(len(x)): # plt.plot(x[i], f(x[i]), "bo") # plt.plot(x[i], f_approx[i], "r-") # plt.show() # Define the function to approximate with the Fourier Series def f(x): return np.abs(x) # Define the number of terms to include in the Fourier Series num_terms = 10 # Define the x values to plot x = np.linspace(-np.pi, np.pi, 1000) # Calculate the Fourier Series coefficients a0 = np.mean(f(x)) an = np.zeros(num_terms) bn = np.zeros(num_terms) for n in range(1, num_terms+1): an[n-1] = (2/np.pi) * np.trapz(f(x) * np.cos(n*x), x) bn[n-1] = (2/np.pi) * np.trapz(f(x) * np.sin(n*x), x) # Calculate the Fourier Series approximation f_approx = a0/2 for n in range(1, num_terms+1): f_approx += an[n-1] * np.cos(n*x) + bn[n-1] * np.sin(n*x) # Plot the results plt.plot(x, f(x), label="f(x)") plt.plot(x, f_approx, label=f"Fourier Series ({num_terms} terms)") plt.legend() plt.show() |

**Conclusion**

**Task 3: The Discount System**

**Introduction**

Conditional statements can be used to build a discount system in Python that calculates the discount rate based on variables like the total cost of the purchase, the number of products purchased, or any other criterion the researcher want. The Customer class accepts a name and a member-type property, which is optional and defaults to None for non-member customers.

**Technical Analysis**

**Figure 7: Code for “Discount system”**

(Source: Created in Pycharm)

The code represents the creation of the “discount system’ in the pycharm platform in “python programming language download”. Based on the customer's membership category, the DiscountRate class contains methods to calculate the discount rates for services and goods. The Visit class computes the total cost after applying the necessary discounts after receiving a Customer object, the cost of services, and the cost of goods as arguments. This program defines the function calculate discount, which receives the total cost of the order and the number of products and returns the discount percentage in accordance with the parameters. The function then determines the discounted total amount using this discount rate.

**Figure 8: Code for “Discount system”**

(Source: Created in Pycharm)

This image also shows the code of the creation of the “discount system’ in the pycharm platform in “python programming language”. The calculate_total_amount function takes in a list of prices, calculates the total amount, calls calculate_discount to determine the discount rate, and subtracts the discounted amount from the total amount to get the final total amount.

**Figure 9: Output of “Discount system”**

(Source: Created in Pycharm)

This is the output after running the implemented code for the design of the discount system. Based on the researcher’s unique needs, can modify this code to include extra restrictions or adjust the discount percentages. The researcher can change the code to calculate the discount based on additional criteria like customer information or product categories.

The code is displayed below:

class Customer: def __init__(self, name, member_type=None): self.name = name self.member_type = member_type
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
def getServiceDiscountRate(self, customer): if customer.member_type in self.service_discounts: return self.service_discounts[customer.member_type] else: return 0
def getProductDiscountRate(self, customer): return self.product_discount
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}")
customer2 = Customer("User1", "Gold") visit2 = Visit(customer2, 80, 20) print(f"Total cost for {customer2}: £{visit2.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**

**Figure 10: Required library **

(Source: Created in Pycharm)

The above image is shown the entire library which is required to use in this task for get the exact outcomes. The “Tkinter” library is used to build the graphical interfaces. On the other hand, the “os” library is used to classify the exact directory.

**Figure 11: Function call for “add_session”**

(Source: Created in Pycharm)

Here are display the approaches of calling the function using the “def” command. In this section, the researcher creates the “add_session” class which is included various options such as a book list. The researcher within the code uses one text file that helps to add all the book lists within one specific location.

**Figure 12: Call the function**

(Source: Created in Pycharm)

The researcher in this part calls the various function using the “def” command such as “Issue Books”, “Delete Books” etc.

**Figure 13: Using deletion method**

(Source: Created in Pycharm)

Delete session helps to delete any book from the book list. Also, the researcher uses the “if-else” condition for detecting the path in a specific way.

**Figure 14: set the format **

(Source: Created in Pycharm)

In this part connect the front with the backend. As well the use of the “Backend” command successfully stores every login data in the user in a specific location. The researcher uses some special commands to set the style such as “label”, “button” etc. Also, this image is shown the procedure of how the “self” command helps to perform the instance of any class.

**Figure 15: Call Registration session**

(Source: Created in Pycharm)

The researcher in the code using the “class” command create the registers function which is store the entire details of the register id.

**Figure 16: Function call for Student**

(Source: Created in Pycharm)

The above image displays the procedure of calling the function using the “self” command. Also in this part, the researcher Set the title of the home page as “Library Management System”. From another point of view, also the researcher in this party set the background image and the background color using the “fg” and “bg” commands.

**Figure 16: Function call for staff**

(Source: Created in Pycharm)

The responsibility of the staff function is to store the entire details of the staff in a specific location.

**Figure 17: Create a class for Librarian**

(Source: Created in Pycharm)

It is the librarian function call process with the help of some of the commands. Also, this image helps to acknowledge the approaches of setting the password, button creation, etc.

**Figure 18: Add all classes**

(Source: Created in Pychar