Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ HELP PLEASE!! There should be 3 different files: romanType.h, romanType.cpp and main.cpp Write a program that converts a number entered in Roman numerals to

C++ HELP PLEASE!! There should be 3 different files: romanType.h, romanType.cpp and main.cpp

Write a program that converts a number entered in Roman numerals to decimal form.

Your program should consist of a class, say romanType. An object of romanType should do the following: a. Store the number as a Roman numeral. b. Convert and store the number into decimal form. c. Print the number as a Roman numeral OR decimal number as requested by the user.

Write two separate functions:: - one to print the number as a Roman numeral - to print the number as a decimal number.

The decimal values of the Roman numerals are: M 1000 D 500 C 100 L 50 X 10 V 5 I 1

Remember, a larger numeral preceding a smaller numeral means addition, so LX is 60. A smaller numeral preceding a larger numeral means subtraction, so XL is 40. Any place in a decimal number, such as the 1s place, the 10s place, and so on, requires from zero to four Roman numerals.

d. Test your program using the following Roman numerals: MCXIV, CCCLIX, and MDCLXVI.

-----------------------------------------------------------------------

Your class romanType's has 2 private data members: 1. string roman_numeral 2. unsigned decimal_number

Your class romanType's methods(functions) are 1. a public default constructor 2. a public custom method, setRoman. Its signature is void setRoman(const string& new_roman_numeral) setRoman assigns its parameter to roman_numeral and invokes toDecimal.

2. a private custom method, toDecimal. Its signature is void toDecimal() toDecimal computes the decimal equivalent of roman_numeral and assigns it to decimal_number. You decide what your program does if new_roman_numeral is not a roman numeral.

3. a public custom method printRoman. Its signature is void printRoman. printRoman displays roman_numeral

4. a public custom method printDecimal Its signature is void printDecimal printDecimal displays decimal_number

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

Guide To Client Server Databases

Authors: Joe Salemi

2nd Edition

1562763105, 978-1562763107

More Books

Students also viewed these Databases questions