Question

In: Computer Science

Assignment 5: Roman Numerals Assignment 5 You must create an application that takes two integer values,...

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.

Solutions

Expert Solution

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:


Related Solutions

Assignment: Create data file consisting of integer, double or String values. Create unique Java application to...
Assignment: Create data file consisting of integer, double or String values. Create unique Java application to read all data from the file echoing the data to standard output. After all data has been read, display how many data were read. For example, if 10 integers were read, the application should display all 10 integers and at the end of the output, print "10 data values were read" My issue is displaying how many integers were read and how many strings...
For this assignment, You will create a NodeJS application which takes a city name as an...
For this assignment, You will create a NodeJS application which takes a city name as an input in its pug template. using openweathermap API, you should get the weather of that particular city and displays that information to a new pug template. You should also store the results in a file in your directory. Following are the detailed requirements. Your application should start with a pug template (similar to HTML page) which has a form with an input field and...
The variable x takes the values ​​from 1 to 100, with these values, create two lists,...
The variable x takes the values ​​from 1 to 100, with these values, create two lists, one where the prime numbers are stored in one, and another where the non-prime numbers are stored, indicate and print the result
Write a function convert_date that takes an integer as a parameter and returns three integer values...
Write a function convert_date that takes an integer as a parameter and returns three integer values representing the input converted into days, month and year (see the function docstring). Write a program named t03.py that tests the function by asking the user to enter a number and displaying the output day, month and year. Save the function in a PyDev library module named functions.py A sample run for t03.py: Enter a date in the format MMDDYYYY: 05272017 The output will...
Create a method that takes a HashMap<Integer, Integer> and returns the sum of the keys of...
Create a method that takes a HashMap<Integer, Integer> and returns the sum of the keys of the HashMap.
Q1) Create a function called max that receives two integer values and returns the value of...
Q1) Create a function called max that receives two integer values and returns the value of the bigger integer. Q2) Complete the missing code in the following program. Assume that a cosine function has already been created for you. Consider the following function header for the cos function. double cos (double x) #include void output_separator() { std::cout << "================"; } void greet_name(string name) { std::cout << "Hey " << name << "! How are you?"; } int sum(int x, int...
Goals In this assignment you must use Java language to program the small application for a...
Goals In this assignment you must use Java language to program the small application for a grocery buyer. You will create meaningful utility that implements simple math model for real problem; design of the application logic; basic user interface. The implementation plus coding style and efficiency will be graded. Description The supermarket uses three pricing scenarios for the local products – Monday, Wednesday, and Friday, the product A has fixed regular price of X dollars. Tuesday and Thursday, the product...
For this assignment, pretend you have been hired by a school district to create an application...
For this assignment, pretend you have been hired by a school district to create an application enabling access to educational videos freely available on the Internet. For examples of places where these videos are available, check out this page: https://www.refseek.com/directory/educational_videos.html (Links to an external site.). For this assignment, you are responsible for developing a database schema (both conceptual and physical) to support this application. The schema must support the following application features: It should be possible to efficiently search the...
Create a ValueGet() method that takes a linked list as input and an integer index and...
Create a ValueGet() method that takes a linked list as input and an integer index and returns the value stored in the node at that index position. Sample Input: 01->100->300->214, index = 2 Output: 300 At index 2 the node has a value of 300 give me the full code. Give the full code with c++
Create a CubesSum application that prompts the user for a non-negative integer and then displays the...
Create a CubesSum application that prompts the user for a non-negative integer and then displays the sum of the cubes of the digits.   b) Modify the application to determine what integers of two, three, and four digits are equal to the sum of the cubes of their digits.(Java Programming )
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT