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

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 »
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 XXXXXXXXXXIf instruments 1, 5 and
9 are playing, the amplifier will generate XXXXXXXXXX).
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:
XXXXXXXXXX
45 9 50
Case 7:
1 XXXXXXXXXX
45 9 50
Case 8:
1359
XXXXXXXXXX
Case 9:
9531
XXXXXXXXXX
Case 10:
315191
XXXXXXXXXX

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
eing rejected.
- Produce co
ect answer: For every test case (test cases are not shared) the algorithm
must give the co
ect answer. If one of the answers is inco
ect, the assignment will
e rejected.
Answered Same Day Nov 03, 2021

Solution

Aditi answered on Nov 08 2021
142 Votes
Capture.PNG
program.py
def getTarget(base, num):
result = ""
while num > 0:
result = 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