Question: CSIS 3 5 2 ( Spring 2 0 2 4 ) Prof. Cabanela Assignment 1 : Evaluating Roman Numerals Due Wednesday, January 1 7 ,

CSIS 352(Spring 2024)
Prof. Cabanela
Assignment 1: Evaluating Roman Numerals Due Wednesday, January 17,2024 at 11pm
This homework is based on Programming Exercise 10-6 from the textbook although I sought to provide more hints here for how to do the problem.
Exercise 10-6(Tweaked): Write a program that converts a number entered in Roman numerals to a positive integer. Your program should consist of a class, say, romanTYpe. An object of type romantype should do the following:
a. Store the number as a Roman numeral (using method setRoman as well as in a constructor, which should initialized to a value of I if no value is given).
b. Convert and store the number as a positive integer (automatically computed by calling method romanToInteger when the value of the Roman numeral is set either by the constructor or by setroman).
c. Return the number as a Roman numeral (using method getRoman) or positive integer (using method getInteger) as requested by the user. The integer values of the Roman numerals are:
\table[[M,1000],[D,500],[C,100],[I,50],[X,10],[V,5],[I,1]]
d. Write a main that requests a roman numeral from the user and the reports the equivalent positive integer. Test your program using the following Roman numerals: MCMLXIX, MCXIV, CCCLIX, and MDCLXVI which should correspond to positive integers 19691114,359, and 1666.
Now for some hints:
A Roman Reminder: In Roman values, the total value is obtained by summing the numerals. For example the year 2023 is written MMXXIII (that is 1000+1000+10+10+1+1+1). However, if the Roman numeral preceding another Roman number in the sequence (read from left to right) is smaller than it, it indicates we should subtract the smaller number from the larger number. So for example, while the year, the year 2024 would be written MMXXIV. We typically see this when we would otherwise repeat a value (less than 1000) more than 3 times. For example, 9 could be written VIIII but traditionally it is written IX to avoid repeating the I four times. The exception to this is for numbers larger than 4000 since there is no Roman numeral greater than M, you are allowed to repeat M as many times as you need to (e.g.9000 is MMMMMMMM).
Remember to #include
 CSIS 352(Spring 2024) Prof. Cabanela Assignment 1: Evaluating Roman Numerals Due

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!