1. Engineering
  2. Computer Science
  3. the following is the functionality of the class addentry...

Question: the following is the functionality of the class addentry...

Question details

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 current 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 error message which is caught and displayed in the main.py file where the operation was attempted. • All error 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 123456 the name of the user file would be 123456.txt.

Solution by an expert tutor
Blurred Solution
This question has been solved
Subscribe to see this solution