In: Computer Science
Assignment 5: Roman Numerals Assignment 5
You must create an application that takes two integer values, adds them together, and then displays the result of that expression as a roman numeral.
Create a two Python scripts:
1. Name your first script roman_numerals.py
2. Name your second script user_input.py
3. The goal of this projects is to practice the principles of abstraction while adding in an element of selection. How much you abstract your code is up to you, but you will be graded on the level of abstraction you achieve with your code. It is suggested that you use the roman_numerals.py file to create functions that abstract any complexity of logic from your user_input.py file.
4. Between the two files, your application must have the following functionality
a. Prompt the user for two integer inputs between 1 and 5.
b. Validate that the number is between 1 and 5.
c. Convert the input values to the appropriate data types
d. Add the two numbers together.
e. If the value is greater than 10, inform the user that the value is too high.
f. If the value is less than 1, inform the user that the value is too low.
g. Display the roman numeral of the value of the added numbers.
Scoring
1. 15% - Compiles without errors
2. 5% - Prompt user for two numbers between 1 and 5
3. 10% - Add two numbers together
4. 10% - Validate the total number is between 1 and 10
5. 10% - Convert the total number to a roman numeral
6. 15% - Display the roman numeral in a message “The roman numeral of the total is ”
7. 20% - Level of abstraction achieved
8. 15% - Meaningful comments a. This includes your header block with your name at the top.
CODE IN PYTHON:
#taking input from the user
a = input("Enter two integers between 1 and 5(inclusive):")
a = int(a)
b = input()
b = int(b)
sum = a+b
#validating the input
if(sum>10):
print("The value is too high...")
elif(sum<1):
print("The value is too low...")
#displaying the respective Roman numeral of number
else:
if(sum==1):
print("The roman numberal of the total is I")
elif(sum==2):
print("The roman numberal of the total is II")
elif(sum==3):
print("The roman numberal of the total is III")
elif(sum==4):
print("The roman numberal of the total is IV")
elif(sum==5):
print("The roman numberal of the total is V")
elif(sum==6):
print("The roman numberal of the total is VI")
elif(sum==7):
print("The roman numberal of the total is VII")
elif(sum==8):
print("The roman numberal of the total is VIII")
elif(sum==9):
print("The roman numberal of the total is IX")
elif(sum==10):
print("The roman numberal of the total is X")
INDENTATION:
OUTPUT: