Question
A student wants to design and implement a Python program to determine their weighted average assignment score on a module. Unlike TM112, you can assume
A student wants to design and implement a Python program to determine their weighted average assignment score on a module. Unlike TM112, you can assume that this is a module where the TMAs are equally weighted. There are many ways of doing this, but here is their initial top-level decomposition.
> Determine weighted average
>> Input a list of TMA scores
>> Calculate the TMA weighting
>> generate a new list that contains the weighted TMA scores
>> Add up the decimal values in the new list
>> Print result rounded to the nearest whole number
- a.In this part you will consider only this part of the top-level algorithm:
- >> Input a list of TMA scores
- >> Calculate the TMA weighting
- >> generate a new list that contains the weighted TMA scores
- >> print the new list
- i.Describe the input data and the output data for this first task.
- ii.Specify one further scores 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 down an algorithm based on Pattern 2.4.
- iv.Implement 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 greater than or equal to 1.
- b.In this part of the question, you will implement the final steps in the top-level decomposition given at the beginning of this question:
- >> Add up the decimal values in the new list
- >> Print result rounded to the nearest whole number
- [16.25, 20.25, 18.00, 22.50]
- i.Identify which of the TM112 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 2.2". A list of all the patterns can be found in the Problem solving and Python quick reference.
- ii.write down 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. Your code should initialise a new list to the list: [16.25, 20.25, 18.00, 22.50]
- c.generate a completed program that performs the whole top-level task:
- > Determine weighted average
- d.There are many ways of decomposing the top-level task:
- > Determine weighted average
PI NUMBER = 6344843
Important note: you do not need to get a working program in part(a) in order to attempt part(b).
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored 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