Answered step by step
Verified Expert Solution
Question
00
1 Approved Answer
A student wants to design and implement a Python program to keep track of the largest single payment they have made from their bank account
A student wants to design and implement a Python program to keep track of the largest single payment they have made from their bank account in a week. The amounts of money, in pennies, paid into their account the credits are represented by positive integers and the amounts of money, in pennies, paid out of their account the debits are represented as negative integers. There are many ways of doing this, but here is their initial toplevel decomposition. Determine the largest single debit Input a list of transactions Create a new list that contains only the negative amounts Find the largest negative value in the new list Print the result in pounds and pence aIn this part you will consider only this part of the toplevel algorithm: Input a list of transactions Create a new list that contains only the negative amounts In order to test your code you should also add the step: Print the new list One of the tests of your code should be for a list of transactions derived from your PI number. In this test, the first five transactions are The final transaction, a debit, is given by the first four digits of your PI number. So for example, for the PI number B your transactions input list would be: iDescribe the input data and the output data for this first task. iiSpecify one further transactions input list you might use in testing, in addition to the list you have created using your PI number. Make sure that you state the test input, the expected output and a brief explanation of why you selected this test. iii.Write an algorithm based on Pattern ivImplement your algorithm as Python code. Your code must match the steps of your algorithm and you should use comments in the code to make it clear how the two correspond. Remember that your code must work for an input list of any length. Marks will be lost if the program does not follow the algorithm. Copy your Python code for this first task into your solution document as text, using an evenly spaced font such as Courier New or Consolas. Name your Python file QaOUCU.py where OUCU is your OU computer username, eg abc Then include the code file in your TMA zip file. You should aim to use only the Python features that are introduced in the module. If you decide to use techniques or language features that TM does not cover, you must give a justification for your decisions, otherwise marks will be lost. marks bIn this part of the question, you will implement the final steps in the toplevel decomposition given at the beginning of this question: Find the largest negative value in the new list Print the result in pounds and pence So for example, for this step, if the input is the list: then the output would be printed. iIdentify which of the TM pattern or patterns could best be applied to the solution of the second task. State clearly the name of the pattern and the pattern number, for example List generation Pattern A list of all the patterns can be found in Problem solving and Python quick reference. iiWrite an algorithm based on the pattern you have identified. You can assume that the new list exists. iii.Implement your algorithm as Python code. This must match the steps of your algorithm and you should use comments in the code to make it clear how the two correspond. Marks will be lost if the program does not follow the algorithm. Your code should include a comment that gives your PI number. Copy your Python code for this second task into your solution document as text, using an evenly spaced font such as Courier New or Consolas. Name your Python file QbOUCU.py where OUCU is your OU computer username, eg abc Then include the code file in your TMA zip file. You should aim to use only the Python features that are introduced in the module. If you decide to use techniques or language features that TM does not cover, you must give a justification for your decisions, otherwise marks will be lost. marks cCreate a completed program that performs the whole toplevel task: Determine the largest single debit and copy this as text, using an evenly spaced font such as New Courier or Consolas, into your solution document. Paste in a screenshot of the outputs in the shell when you run this Python
A student wants to design and implement a Python program to keep track of the largest single payment they have made from their bank account in a week. The amounts of money, in pennies, paid into their account the credits are represented by positive integers and the amounts of money, in pennies, paid out of their account the debits are represented as negative integers. There are many ways of doing this, but here is their initial toplevel decomposition.
Determine the largest single debit
Input a list of transactions
Create a new list that contains only the negative amounts
Find the largest negative value in the new list
Print the result in pounds and pence
aIn this part you will consider only this part of the toplevel algorithm:
Input a list of transactions
Create a new list that contains only the negative amounts
In order to test your code you should also add the step:
Print the new list
One of the tests of your code should be for a list of transactions derived from your PI number. In this test, the first five transactions are The final transaction, a debit, is given by the first four digits of your PI number. So for example, for the PI number B your transactions input list would be:
iDescribe the input data and the output data for this first task.
iiSpecify one further transactions input list you might use in testing, in addition to the list you have created using your PI number. Make sure that you state the test input, the expected output and a brief explanation of why you selected this test.
iii.Write an algorithm based on Pattern
ivImplement your algorithm as Python code. Your code must match the steps of your algorithm and you should use comments in the code to make it clear how the two correspond. Remember that your code must work for an input list of any length. Marks will be lost if the program does not follow the algorithm. Copy your Python code for this first task into your solution document as text, using an evenly spaced font such as Courier New or Consolas. Name your Python file QaOUCU.py where OUCU is your OU computer username, eg abc Then include the code file in your TMA zip file.
You should aim to use only the Python features that are introduced in the module. If you decide to use techniques or language features that TM does not cover, you must give a justification for your decisions, otherwise marks will be lost.
marks
bIn this part of the question, you will implement the final steps in the toplevel decomposition given at the beginning of this question:
Find the largest negative value in the new list
Print the result in pounds and pence
So for example, for this step, if the input is the list:
then the output would be printed.
iIdentify which of the TM pattern or patterns could best be applied to the solution of the second task. State clearly the name of the pattern and the pattern number, for example List generation Pattern A list of all the patterns can be found in Problem solving and Python quick reference.
iiWrite an algorithm based on the pattern you have identified. You can assume that the new list exists.
iii.Implement your algorithm as Python code. This must match the steps of your algorithm and you should use comments in the code to make it clear how the two correspond. Marks will be lost if the program does not follow the algorithm. Your code should include a comment that gives your PI number. Copy your Python code for this second task into your solution document as text, using an evenly spaced font such as Courier New or Consolas. Name your Python file QbOUCU.py where OUCU is your OU computer username, eg abc Then include the code file in your TMA zip file.
You should aim to use only the Python features that are introduced in the module. If you decide to use techniques or language features that TM does not cover, you must give a justification for your decisions, otherwise marks will be lost.
marks
cCreate a completed program that performs the whole toplevel task:
Determine the largest single debit
and copy this as text, using an evenly spaced font such as New Courier or Consolas, into your solution document. Paste in a screenshot of the outputs in the shell when you run this Python
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access with AI-Powered Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started