Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a Python program that accepts a year written as a four-digit Arabic (ordinary) numeral and outputs the year written in Roman numerals. Important: Roman

Write a Python program that accepts a year written as a four-digit Arabic (ordinary) numeral and outputs the year written in Roman numerals.

Important: Roman numerals are V for 5, X for 10, L for 50, C for 100, D for 500, and M for 1,000.

Recall that some numbers are formed by using a kind of subtraction of one Roman digit; for example, IV is 4 produced as V minus I, XL is 40, CM is 900, and so on.

A few sample years: MCM is 1900, MCML is 1950, MCMLX is 1960, MCMXL is 1940, MCMLXXXIX is 1989.

(Hints: Use division and mod.)

Assume the year is between 1000 and 3000.

Define the following functions (value returning functions):

returnRomanThousandsPlace(): Accepts a thousands place integer number as an argument and returns the roman numerals for the thousand place.

returnRomanHundredsPlace(): Accepts a hundreds place integer number as an argument and returns the roman numerals for the hundreds place.

returnRomanTensPlace(): Accepts a tens place integer number as an argument and returns the roman numerals for the tens place.

returnRomanOnesPlace(): Accepts a ones place integer number as an argument and returns the roman numerals for the ones place.

Test and verify your program and it's output.

***Assume that the user is entering a year between 1000 and 3000 correctly.

THIS IS WHAT THE OUTPUT SHOULD LOOK LIKE:

- The bold text is the user's input.

*************************************************************************************

Enter a year between 1000 to 3000: 1952 Your number in roman numerals is: MCMLII

*************************************************************************************

Enter a year between 1000 and 3000: 2048 Your number in roman numerals is: MMXLVIII

*************************************************************************************

Enter a year between 1000 and 3000: 2500 Your number in roman numerals is: MMD

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions