Great Deal! Get Instant $10 FREE in Account on First Order + 10% Cashback on Every Order Order Now

ITECH1400 – Foundations of Programming – SEM3/18 School of Science, Engineering and Information Technology ITECH1400 – Foundations of Programming – SEM3/18 School of Science, Engineering and...

1 answer below »
ITECH1400 – Foundations of Programming – SEM3/18
School of Science, Engineering and Information Technology
ITECH1400 – Foundations of Programming – SEM3/18
School of Science, Engineering and Information Technology
ITECH1400 – Foundations of Programming – SEM3/18
School of Science, Engineering and Information Technology
ITECH1400 - Assignment 1 – Money Manager
Due Date: Thursday of Week 11 at 4pm
This assignment will test your skills in designing and programming applications to specification and is worth 20% of your non-invigilated (type A) marks for this course. This is an INDIVIDUAL ASSIGNMENT – and while you may discuss it with your fellow students, you must not share designs or code or you will be in
each of the university plagiarism rules. This assignment should take you approximately 20 hours to complete.
Assignment Overview
You are tasked with creating an application that uses a GUI that simulates a simple money manager. This tool is used to track all spending of an individual.
The assignment is
oken up into the following main components:
1.) The ability to provide a login screen to prevent other people from viewing the information contained in the tool

2.) The ability to view the cu
ent balance funds, add purchases made and deposits into the balance

3.) The ability to save the transactions to a file so that you can log in, add transactions to the application, log out and then return to find all of the transactions still there – i.e. the data is persistent.

4.) The ability to display a graph of your spending
oken down by type – i.e. food, bills, rent.

5.) A Test Case that ensures that your simple money manager works as required.

Your submission should consist three Python scripts that implement the computer program (moneymanager.py, main.py and testmoneymanager.py).
You are provided with a 'stub' of each of these files which contain all the function declarations and comments which describe the role of the function and how it can be put together, but you will have to write the code for vast majority of the functions yourself. You are also provided with a stub of the moneymanagertestcase.py file.
Your final submission should be a zipped archive (i.e. ‘zip file’) containing your completed Python scripts.
    
Assignment Part 1 Details
Class Design – Money Manager Tool
The following design for MoneyManager
MoneyManage

user_number: int
pin_number: String
alance: float
transaction_list: list of two-tuples
add_entry(amount, entry_type)
deposit_funds(amount)
get_transaction_string()
save_to_file()

The following is the functionality of the class:
· add_entry – this adds a new entry into the money manager representing the spending of the user. This includes the amount spent and the type of item the money was spend on. It also removes the amount from the cu
ent balance. For the sake of simplicity the type of item the money was spent on can only be food, rent, bills, entertainment or other – any other type will raise an exception that should be handled
· Each transaction in the transaction_list is a tuple containing the word Deposit followed by an amount or EntryType followed by an amount
· The user the tool represents cannot go into a negative balance so the user cannot spend money that is not available in their user. So if they have $100 in their user and then want to add an entry to spend $150 an exception will be raised with a suitable e
or message which is caught and displayed in the main.py file where the operation was attempted.
· All e
or messages, such as those from exceptions, should be displayed in a pop-up message box
· The get_transaction_string method should loop over all the transactions in the transaction_list creating a string version (with newline characters) of all the transactions associated with the user.
· The save_to_file function should save the user_number, pin_number, and balance in that order to a file called .txt followed by the transaction list string generated from the get_transaction_string() method. The name of the user file is NOT '.txt' - the name of the file is the ACTUAL USER NUMBER followed by ".txt", so for an user with user_number XXXXXXXXXXthe name of the user file would be XXXXXXXXXXtxt.
The Main Python Script
Our main.py script will contain all the main logic for our program. It will allow us to:
· Enter a user number via an Entry field by using the keyboard,
· Enter a PIN number via an Entry widget (we can use the keyboard OR a series of buttons to enter the
PIN),
· Once we are logged in we must be able to: o See the balance of the user, o Deposit money for the user,
· Add entries to represent spending of funds from our user (only up to the amount we have available),
· Display a plot of spending o Log out of our user.
Every time a successful deposit or entry is made then a new transaction should be added to the user's transaction list. When we log out then the user file is overwritten with the new user details including our new balance and any transactions if any have been made. The format of the user text file is as follows (each value on separate lines): user_number user_pin balance

123456
7890
800.00
0.33
After these first four lines we may have a number of transactions, each of which is specified as two lines. A deposit is indicated by the word Deposit on one line and then the amount on the next like. For example a deposit of $500
would look like this:
Deposit
500.00
Similarly, a entry is also specified as two lines – first the word being the type of entry and then on the next line the amount, for example entries representing rent of $200 and bills of $250 would look like this:

Rent
200.00
Bills
250.00

You are provided with an example user file called XXXXXXXXXXtxt – this file along with others will be used to mark your assessment, so you should make sure that your final submission can use users in this format successfully. You are also provided with a video demonstration of the completed assignment along with this document. Your application should match this user interface and function in the same way.
Login Screen
When the application is first launched, it should open a window that is "500x660" pixels in size (use the window object’s geometry function to set this). Set the title of the window to "FedUni Money Manager" using the top-level window object's winfo_toplevel().title() function.
The window uses the GridManager layout manager for placing GUI elements (e.g. 'widgets'), it contains a Label that spans the top of the window saying "FedUni Money Manager" (font size is 28). On the next line is a label saying "User Number" and then an Entry widget for the user to type in their user number and an entry for the PIN number.
It then has a series of buttons from 0 through 9, along with a Log In button and a Clea
Cancel button.
Each time a number is pressed it is added to a string - for example, if the user pushed the 4 button then the 3 button then the 2 button and then the 1 button then the string should contain the text "4321". By using the show="*" attribute you can 'mask' the input so that anyone looking over your shoulder cannot see the exact pin number, they'll just see "****" instead. When the Clea
Cancel button is pressed, or when a user "logs out" then this PIN string should be reset to an empty string.
When the Log In button is pressed then the program should attempt to open the file with the user number followed by ".txt" - so in the example below, because the user number entered was "123456", the program will attempt to open the file "123456.txt".
If that file could not be opened then a messagebox should display a suitable e
or message such as "Invalid user number - please try again!". You will have to "try/catch" this risky functionality to avoid the program crashing - see the week 7 lecture materials if you need a recap.
If the user exists, then MoneyManager object should be created and the fields of the MoneyManager object should be set (e.g. user_number, pin_number, balance, and the transaction_list).
Because you don't know how many transactions are stored for this user user, after reading the first four lines you will need to attempt to read two lines and if they exist create a tuple of the transaction (i.e. it's type and amount) and then add it to the MoneyManager object's transaction_list - for example you may do the following in a loop:
# Try to read a line,
eak if we've hit the end of the file line = read_line_from_user_file() if not line:
eak
else:
# read another line, create a tuple from both lines and append the # tuple to the the MoneyManager object's transaction_list

The user screen has:
· A large "FedUni Money Manager" label at the top that spans 5 columns (font size is 22),
· A label with the user number followed by the actual user number displayed,
· A label with the cu
ent balance followed by the actual balance,
· A log out button which saves the user file (overwriting it) and causes all widgets to be removed from the screen and the log in screen displayed again,
· An "Amount" label followed by an amount Entry widget where you can type in how much to deposit or an entry added,
· Deposit and Withdraw buttons that deposit or withdraw funds using the MoneyManager classes methods to do so,
· A Text widget (i.e. multi-line text) that shows all the transactions associated with the user. The height of this widget is 10 lines and the width of the widget is 48 characters.
· To the right of the Text widget this is a scrollbar which can be used to scroll the Text widget (it is not really showing in the above screenshot because the Text widget does not have more than 10 lines worth of content), and finally
· At the bottom of the screen is a plot (histogram) of the spending of the user
oken down by type

Money
Answered Same Day Jan 24, 2021 ITECH1400

Solution

Samrakshini R answered on Jan 26 2021
139 Votes
pp1/.idea/misc.xml

pp1/.idea/modules.xml





pp1/.idea/pp1.iml








pp1/.idea/workspace.xml

















































hand
clea






















































































1548477453385


1548477453385


























































































pp1/123456.txt123456
7890
4500.0
Deposit
3000.0
Deposit
4000.0
Rent
2000.0
pp1/main.pyimport tkinter as tk
from tkinter import *
from pymsgbox import *
from tkinter import messagebox
from pylab import plot, show, xlabel, ylabel
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg
from matplotlib.figure import Figure
from collections import defaultdict
from pprint import pprint
import matplotlib.pyplot as plt
from moneymanager import MoneyManage
win = tk.Tk()
#Set window size here to '540 x 640'
win.geometry("540x640")
#Set the window title to 'FedUni Money Manager'
win.title('FedUni Money Manager')
#The user number and associated variable
user_number_var = tk.StringVar()
#This is set as a default for ease of testing
user_number_var.set('123456')
user_number_entry = tk.Entry(win, textvariable=user_number_var)
user_number_entry.focus_set()
#The pin number entry and associated variables
pin_number_var = tk.StringVar()
#This is set as a default for ease of testing
pin_number_var.set('7890')
#Modify the following to display a series of * rather than the pin ie **** not 1234
user_pin_entry = tk.Entry(win, text='PIN Number', textvariable=pin_number_var,show='*')
#set the user file by default to an empty string
user_file = ''
# The balance label and associated variable
alance_var = tk.StringVar()
alance_var.set('Balance: $0.00')
alance_label = tk.Label(win, textvariable=balance_var)
# The Entry widget to accept a numerical value to deposit or withdraw
#amount_var = tk.StringVar()
tkVar=StringVar(win)
amount_entry = tk.Entry(win)
entry_type=tk.Entry(win)
# The transaction text widget holds text of the transactions
transaction_text_widget = tk.Text(win, height=10, width=48)
# The money manager object we will work with
user = MoneyManager()
# ---------- Button Handlers for Login Screen ----------
def clear_pin_entry():
'''Function to clear the PIN number entry when the Clear / Cancel button is clicked.'''
# Clear the pin number entry here
# user_pin_entry.delete(0,6)
user_pin_entry=''
set(user_pin_entry)
def handle_pin_button(n):
'''Function to add the number of the button clicked to the PIN number entry.'''
# Limit to 4 chars in length
# Set the new pin number on the pin_number_va
def log_in():
'''Function to log in to the banking system using a known user number and PIN.'''
global use
global pin_number_va
global user_file
global user_num_entry
# Create the filename from the entered account number with '.txt' on the end
#file = open(user_number_var + '.txt', "w+")
# Try to open the account file for reading

# Open the account file for reading
try:
file = open(str(user_number_var) + ('.txt'), "w+")
# First line is account numbe
us_num=file.readline()
# Second line is PIN number, raise exceptionk if the PIN entered doesn't match account PIN read
pin_num=file.readline()
if(not(pin_number_var==pin_num)):
raise Exception('The pin number is not valid')
# Read third and fourth lines (balance and interest rate)
bal=float(file.readline())
# Section to read account transactions from file - start an infinite 'do-while' loop here
transactions=[]
temp=()
while (not (file.readline() == None)):
temp.append(file.readline());
temp.append(file.readline());
transactions.append(temp);
# Attempt to read a line from the account file,
eak if we've hit the end of the file. If we
# read a line then it's the transaction type, so read the next line which will be the transaction amount.
...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here