Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a program called Roman.java that takes a positive integer between (but not

ID: 3649137 • Letter: W

Question

Write a program called Roman.java that takes a positive integer between (but not including) 0 and 4000 and converts it to Roman Numerals. If you need help with what the Roman numerals are, you can head to http://literacy.kent.edu/Minigrants/Cinci/romanchart.htm or just hit up Google. Your program should print an error message and exit if the number does not fall into the appropriate range. Your program should throw an exception if the number is not an integer.

please use only if and if else statements,scanner,string, ... please do not use any WHILE or FOR loops or methods. I am a beginner and have not gone over that yet. that is how the screen should look like Roman.java

Please enter an integer greater than 0 and less than 4000: 1978

the roman numeral is MCMLXXVIII

Please answer as I exactly requested. Do not write the code in C or C++ . only JAVA and no FOR or WHILE loops thanks a lot

Explanation / Answer

required code: BEGIN PROCEDURE ROMAN (INTEGER VALUE NUMBER; STRING(15) RESULT CHARACTERS; INTEGER RESULT LENGTH); COMMENT Returns the Roman number of an integer between 1 and 3999. "MMMDCCCLXXXVIII" (15 characters long) is the longest Roman number under 4000; BEGIN INTEGER PLACE, POWER; PROCEDURE APPEND (STRING(1) VALUE C); BEGIN CHARACTERS(LENGTH|1) := C; LENGTH := LENGTH + 1 END; PROCEDURE I; APPEND(CASE PLACE OF ("I","X","C","M")); PROCEDURE V; APPEND(CASE PLACE OF ("V","L","D")); PROCEDURE X; APPEND(CASE PLACE OF ("X","C","M")); ASSERT (NUMBER >= 1) AND (NUMBER < 4000); CHARACTERS := " "; LENGTH := 0; POWER := 1000; PLACE := 4; WHILE PLACE > 0 DO BEGIN CASE NUMBER DIV POWER + 1 OF BEGIN BEGIN END; BEGIN I END; BEGIN I; I END; BEGIN I; I; I END; BEGIN I; V END; BEGIN V END; BEGIN V; I END; BEGIN V; I; I END; BEGIN V; I; I; I END; BEGIN I; X END END; NUMBER := NUMBER REM POWER; POWER := POWER DIV 10; PLACE := PLACE - 1 END END ROMAN; INTEGER I; STRING(15) S; ROMAN(1, S, I); WRITE(S, I); ROMAN(3999, S, I); WRITE(S, I); ROMAN(3888, S, I); WRITE(S, I); ROMAN(2009, S, I); WRITE(S, I); ROMAN(405, S, I); WRITE(S, I); END.
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote