Question
The roman class and The CalculatorRomanClass You are to design and implement a Roman numeral calculator. The subtractive Roman numeral notation commonly in use today
The roman class and The CalculatorRomanClass
You are to design and implement a Roman numeral calculator. The subtractive Roman numeral notation commonly in use today was used only rarely during the time of the Roman Republic and Empire. For ease of calculation, the Romans most frequently used a purely additive notation in which a number was simply the sum of its digits (4 equals IIII in this notation, not IV). Each number starts with the digit of highest value and ends with the digit of smallest value. This is the notation you will use in this program.
Your program inputs two Roman numbers and an arithmetic operator and prints out the result of the operation, also as a Roman number. The values of the Roman digits are as follows: I 1 V 5 X 10 L 50 C 100 D 500 M 1000 Thus, the number MDCCCCLXXXXVI represents 1996, because 1996 really consists of: 1000 + 500 + 100 + 100 + 100 + 100 + 50 + 10 + 10 + 10 + 10 + 5 + 1. M D C C C C L X X X X V I The arithmetic operators that your program should recognize in the input are +, -, *, and /. These should perform the C++ operations of integer addition, subtraction, multiplication, and division. One way of approaching this problem is to convert the Roman numbers into integers, perform the required operation, and then convert the result back into a Roman number for printing. Assume that the input numbers are in purely additive form - that is, digits are followed only by digits of the same or lower value. Also assume that the letters are all legal, no need to check for errors in the input file. Also, assume that the answer to each calculation will be a positive number. REQUIREMENTS: This program is to be done by creating two classes, the first class is called Roman which includes the following methods: setRoman()
getRoman()
convert_Roman_To_Int()
convert_Int_To_Roman()
display_Roman()
add more methods if needed, also nadd the appropriate constructors and instance variables.
The other roman class RomanCalculator extends from JPanel and implements ActionListerns. The calculator will be a panel with 3 text boxes for data entry., 3 labels for the display and 14 buttons, 7 buttons for the roman numbers, 5 buttons for the operations, one button for the equal, one button for clearing textboxes and labels.
(The claculator has 3 text boxes, Roman1, Roman2, and Result. Next to each textbox there is a label that will be used to display the integer value of each roman number. The result texbox, will have the result of two Romans based on the operation chosen. The CE button will clear everything.
The result and the labels shuld not be editable.
Overall: The roman class
The CalculatorRomanClass
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started