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
Deliverables and working in groups
ZIP file containing:
o Source code (Python)
o Group info* (only if working in group)
Students are also required to submit the source code of their solution implemented in Python. Solution must be in a single file. No external libraries can be used (i.e. it must work on any computer with standard Python 3 installation).
The flowchart is not required for this assignment, but it can be submitted.
The assignment can be completed by a student alone, or in a group of maximum two students. If a student is working alone, the student should submit one ZIP file containing source code in Python. The name of the zip file should be in the following format: studentnumber.zip
If working in a group, only one group member submits the assignment. The ZIP file should apply the rules mentioned above, PLUS it must include .txt file containing information about members of the team (first row: student_number1 first_name1 last_name1, second row: student_number2 first_name2 last_name2). The name of the zip archive is expected to be in the following format: studentnumber1_studentnumber2.zip
In case of submitting via Google Classroom, one student makes the submission sends the zip file. The other group member must also use the submit option, but instead of sending the file, enters the information about the group leader that made the submission (student number, first, last name).
Incomplete and improper submissions will be rejected!
Grading
The assignment will be evaluated as either PASS or FAIL. To get points for Analysis 1 course, student must pass the summative assignment together with passing the exam.
Students will receive feedback from the teacher via Google Classroom (or any other channel if specifically announced by the teacher).
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.
Deadlines
The students are required to submit the assignment before the midnight of November 10th (Sunday). Submissions after the deadline will be rejected.
Using auto grader
* The process detailed here assumes the assignment being delivered via Google classroom and then manually inspected by the teacher. Alternatively, a teacher may opt to use auto grader for evaluating assignment. If your teacher chooses to use auto grader, you will be given additional instructions on how to register and submit the code.
Reviews
There are no reviews yet.