[SOLVED] CS代考 COMP9021 PRINCIPLES OF PROGRAMMING Term 3, 2022

30 $

File Name: CS代考_COMP9021_PRINCIPLES_OF_PROGRAMMING_Term_3,_2022.zip
File Size: 527.52 KB

SKU: 7857983341 Category: Tags: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,

Or Upload Your Assignment Here:


COMP9021 PRINCIPLES OF PROGRAMMING Term 3, 2022
Assignment 1 – More Hints
1. Explainingthefollowingexampleofthethirdkindofinput(Please convert *** minimally):
$ python3 roman_arabic.py

Copyright By PowCoder代写加微信 assignmentchef

How can I help you? Please convert ABCADDEFGF minimally Sure! It is 49269 using BA_C_DEF_G
First, remember the two important Roman numeral rules below:
1. A Roman symbol is repeated three times but not more than that. However, the symbols V (5), L (50) and D (500) are never repeated.
2. The Roman symbols V (5), L (50) and D (500) are never written to the left of a symbol of greater value, i.e., V (5), L (50) and D (500) are never subtracted. The symbol I (1) can be subtracted from V (5) and X (10) only. The symbol X can be subtracted from L (50) and C (100) only.
Note also that “minimally” means we are looking for a generalised Roman symbols that can convert the given numeral into a smallest integer number.
Let us start assigning Roman numeral values from the right-hand side such that the value is minimum.
Starting with F, we can see it is repeated and we have to assign the minimum value to FGF in order to assign the minimum value to F. From a number of various combinations, we know that the only possible solution here is F=10 and G=1 (try out combinations of 1, 5, 10 here to see why this is the right one). Thus FGF=19.
Let us move now to the next element, which is E. We also need to consider the element after E in order to assign a smaller combination, if possible, in this case. The next element is D, which is repeated and therefore cannot be less than E. Thus, we assign E the smallest number not used yet, which is 50. Moving on to D, since it is repeated, it cannot be greater than the next element A. Thus, we assign the smallest number not yet used which is 100 to D.
Till now, our number DDEFGF is resulting in 269 using DEF_G (value 5 not assigned).
The next element is A and it is repeated. To assign a value to A, we must assign a value so that ABCA does not violate Roman numeral rules. That is, A < B and B > C. Because of AB (A and B being next to each other), we cannot assign A as 500 (500 cannot be subtracted from any number).

Let us say we assign 1000 to A. Then B can be either 5000 or 10000. B cannot be 5000 because that would mean C can only be 500. Also, B cannot be 10000 as it would mean C should be 5000 or 500 (both are invalid assignments).
Let us try to assign 10000 to A (it cannot be assigned 5000 since it is repeated). B can be either 50000 or 100000. If B is 50000, C can be either 5000, 1000 or 500. C cannot be 5000 or 500 (since they be subtracted from any number). C can be 1000.
Consequently, the smallest we can come up with here is 10000 for A, 50000 for B, and 1000 for C, and ABCA = 50000 – 10000 + 10000 – 1000 = 49000.
Thus, the total becomes 49269 using BA_C_DEF_G (values 5, 500 and 5000 not assigned).
2. More examples about the third kind of input (Please convert *** minimally):
$ python3 roman_arabic.py
How can I help you? Please convert AZERTY minimally Sure! It is 444 using ZAREYT
$ python3 roman_arabic.py
How can I help you? Please convert XXXVVVIII minimally Sure! It is 333 using X_V_I
$ python3 roman_arabic.py
How can I help you? Please convert AhZhJ minimally Sure! It is 691 using Ah_Z_J
$ python3 roman_arabic.py
How can I help you? Please convert BCBC minimally Hey, ask me something that’s not impossible to do!

程序代写 CS代考加微信: assignmentchef QQ: 1823890830 Email: [email protected]

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[SOLVED] CS代考 COMP9021 PRINCIPLES OF PROGRAMMING Term 3, 2022
30 $