Analysis 1, 1920 Assignment Analysis 1, 2019/2020, Period 1 Experimental amplifier summative assignment Assignment objectives - Evaluate the ability to apply concepts learned in Analysis 1 (numeral...

1 answer below »
Python Assignment


Analysis 1, 1920 Assignment Analysis 1, 2019/2020, Period 1 Experimental amplifier summative assignment Assignment objectives - Evaluate the ability to apply concepts learned in Analysis 1 (numeral systems, Boolean logic, sets, algorithms) to problem solving. Problem statement A new startup company “Sound Master” claims to have developed a revolutionary sound amplification algorithm. According to their specification, the algorithm takes decimal input as the sound wave, with each digit of that input representing a certain instrument playing. There are no more than 9 instruments (therefore only digits 1 – 9 are used) and there could be multiple instruments of the same type playing at the same time. Example: input 12 means that instruments 1 and 2 are playing. Input 21 also means that instruments 1 and 2 are playing. Input 135 means that instruments 1, 3 and 5 are playing. Also, input 11351 means that instruments 1, 3 and 5 are playing. In the same manner, input 2121 shows that only instruments 1 and 2 are playing. The amplifier algorithm takes all instruments playing and generates the new “amplified” value that is equal to the sum of the numerical values assigned to each instrument. Therefore, if instruments 1 and 2 are playing, the amplifier will generate 3 (1 + 2). If instruments 1, 5 and 9 are playing, the amplifier will generate 15 (1 + 5 + 9). To make the amplifier compatible with different devices on the market, before sending the amplified value, the algorithm must convert it to a numeral base, that is equal to the number of unique instruments playing. Hence, if only 2 instruments are playing, the output must be given in base 2 (binary). If 3 instruments are playing, then the output must be in base 3 and so on, up to all 9 instruments playing where the output must be in base 9. The exception is if only one instrument is playing, and then the output must be in base 10 (remains decimal). You have been hired by “Sound Master” to implement this algorithm. To make sure it is successful, you have to do the following: - Read (from standard input) source, that is a decimal input (source > 0), - Calculate amplified value, for given source, according to the amplification procedure described above, - Find conversion base for each source, according to the amplification procedure above, - Transform amplified value to target value using base. - Output in one line amplified, base and target values, in the order given here. Example input and output: Input is given in BLUE. Required output is given in RED. There should be NO textual MESSAGES to the user. Only read input and give output according to the algorithm. - In the first line read source, that is an integer (source > 0). - In the second line output the following: amplified value (single space) base (single space) target. Case 1: 1 1 10 1 Case 2: 2 2 10 2 Case 3: 12 3 2 11 Case 4: 1221 3 2 11 Case 5: 12 3 2 11 Case 6: 123456789 45 9 50 Case 7: 123123123123456789999 45 9 50 Case 8: 1359 18 4 102 Case 9: 9531 18 4 102 Case 10: 315191 18 4 102 Grading In order to PASS the assignment must: - Comply with format: Have input and output formatted exactly according to the instructions given above. Printing text in the wrong line will result in the assignment being rejected. - Produce correct answer: For every test case (test cases are not shared) the algorithm must give the correct answer. If one of the answers is incorrect, the assignment will be rejected.
Answered Same DayNov 03, 2021

Answer To: Analysis 1, 1920 Assignment Analysis 1, 2019/2020, Period 1 Experimental amplifier summative...

Aditi answered on Nov 08 2021
155 Votes
Capture.PNG
program.py
def getTarget(base, num):
result = ""
while num > 0:
res
ult = str(num % base) + result
num = int(num / base)
return result
instruments = [0] * 10
sound = input()
for s in sound:
val = int(s)
instruments[val] += 1
amplified =...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here