COMPUTER SCIENCE homework in C++

profilejessicalawrence30

C++ easy program

I have three files: a header (a class), a main and a cpp

I basically need to edit the cpp to make the whole program work.

 

THESE ARE THE INSTRUCTIONS

 

1. roman.hpp: contains the declaration of class Roman.

2. roman.cpp: contains the incomplete implementation of the member function IncreaseWith() and two other functions convertIntToRoman() and convertRomanToInt().

 

You will complete roman.cpp such that the test cases in subdirectory tests pass.

You should not edit or modify roman.hpp.

Instance of class Roman stores a number as a Roman numeral string.

An object of class Roman is initialized either with a Roman numeral string or an integer.

The default constructor stores an empty string.

Member function GetInt() converts the stored Roman numeral string to an integer and returns it.

Empty string is considered to be a 0.

Member function GetRoman() simply returns the stored Roman numeral string.

The overloaded member function SetRoman() can take either an integer or a Roman numeral string to update the stored number.

Member function IncreaseWith() updates the current number by adding the Roman number passed as argument.

Non-member function convertIntToRoman() converts an integer to a Roman numeral string while convertRomanToInt() converts a Roman numeral string to an integer.

Please see the unit tests for more details on how the member functions work.

Roman Numerals:

A Roman numeral string is a sequence of characters ∈ {I, V, X, L, C, D, M}.

For example, 74 in decimal is represented as “LXXIV” = 50 + 10 + 10 - 1 + 5.

I  IV V IX X XL L XC  C   CD   D    CM   M

1 4 5 9 10 40 50 90 100 400 500 900 1000

You can use this table as a reference for integer-to-roman or roman-to-integer conversion.

Hard coding mappings between roman numerals and their corresponding integer values will result in a penalty.

Assumptions:

• The input Roman numeral string is always valid.

• Since there cannot be more than 3 consecutive sequence of a Roman numeral character, the maximum possible number will be 3999, i.e. MMMCMXCIX.

• The input integer will always be ≥ 0.

• The final value to be updated by IncreaseWith() will always be ≤ 3999.

 

Willing to pay 20$

I NEED IT IN 24 HOURS

THAT MEANS 7:00 PM EST (USA TIME)

on Wednesday Febuary 8 2017

    • 7 years ago
    • 20
    Answer(1)

    Purchase the answer to view it

    blurred-text
    • attachment
      c.rar
    Bids(1)