PYTHON!!! For this question, we will use a simplified version of the Roman Numerals System to represent positive integers. The digits in this system are I, V, X, L, C, D and M. Each digit corresponds...


PYTHON!!!


For this question, we will use a simplified version of the Roman Numerals System to represent positive integers. The digits in this system are I, V, X, L, C, D and M. Each digit corresponds to a decimal value, as shown below:


I = 1, V = 5, X = 10, L = 50, C = 100, D = 500, M = 1000


A number in the simplified Roman numerals system is a sequence of Roman digits, which follow these 2 rules:


1. The digits form a monotonically non-increasing sequence. That is the value of each digit is less than or equal to the value of the digit that came before it. For example, DLXXVI is a monotonically non-increasing sequence of Roman digits, but XIV is not.


2. There is no limit on the number of times that ‘M’ can appear in the number. ‘D’, ‘L’ and ‘V’ can each appear at most one time in the number. ‘C’, ‘X’ and ‘I’ can each appear at most four times in the number.


For example: IIII, XVII, and MMMMMMDCCLXXXXVII are legal numbers in our simplified Roman numeral system, but IIIII, XIV, VVI and CCXLIII ARE NOT!!!


Write two programs that perform the following:


1. The first program should ask the user to enter a number that is represented in the simplified Roman numerals system, and the program will print it’s decimal value.


For example, an execution would look like the following. User input is shown in bold face font.


Enter number in the simplified Roman system:CXXXXVII


CXXXXVII is 147


2. Reads from the user a (decimal) number, and prints it’s representation in the simplified Roman numerals system. For example, an execution would look like the following. User input is shown in bold face font.


Enter decimal number:147


147 is CXXXXVII


DO NOT USE any language construct not taught. This includes user-defined functions (including main()), file i/o, exception handling, dictionaries, lists, tuples, and object orientation!!!

Jun 08, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here