Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Programming Language: C++ I need the codes for extRomanType.cpp, extRomanType.h, main.cpp, romanType.cpp, romanType.h // I will definitely rate and give thumbs up. Arithmetic with Roman

Programming Language: C++

I need the codes forextRomanType.cpp, extRomanType.h, main.cpp, romanType.cpp, romanType.h

// I will definitely rate and give thumbs up.

image text in transcribedimage text in transcribed
Arithmetic with Roman Numerals Instructions In programming Exercise 6 in Chapter IO, we dened a class romanType to implement Roman numbers in a program. In that exercise, we also implemented a function, IomanToPositiveInteger , to convert a Roman number into its equivalent positive integer. Modify the denition of the class IomanType so that the member variables are declared as protected . Furthermore, overload the stream insertion and stream extraction operators for easy input and output. The stream insertion operator outputs the Roman number in the Roman format. Also, include a member function, positiveIntegerToRoman . that converts a positive integer to an equivalent Roman number format. Write the definition of the member function positivelntegeIToRoman. For simplicity, we assume that only the letter I can appear in front of another letter and that it appears only in front of the letters V and X. For example, 4 is represented as IV, 9 is represented as IX, 39 is represented as XXXIX, and 49 is represented as WIX Also, 40 will be represented as XXXX, 190 will be represented as CLXXXX, and so on. Extending the romanType class E Instructions Derive a class extRomanType from the class romanType to do the following: In the class extRomanType , overload the arithmetic operators + , - , * , and / so that arithmetic operations can be performed on Roman numbers. Also, overload the pre- and post-increment and decrement operators as member functions of the class extRomanType . To add (subtract, multiply, or divide) Roman numbers, add (subtract, multiply, or divide, respectively) their positive integer representations and then convert the result to the Roman number format. For subtraction, if the first number is smaller than the second number, output a message saying that, "Because the first number is smaller than the second, the numbers cannot be subtracted". Similarly, for division, the numerator must be larger than the denominator. Use similar conventions for the increment and decrement operators. Write a main( ) to test your class. FILETREE ~/sandbox required files/codes extRomanType.cpp

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

Modern Dental Assisting

Authors: Doni Bird, Debbie Robinson

13th Edition

978-0323624855, 0323624855

Students also viewed these Programming questions