id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

 

jebbert@volusia.k12.fl.us > test2021_11_04_HL_un
prev  |  next  |  chance

Given an input parameter 'num', return its Roman Numeral equivalent if 'num' is a positive integer value in the range 1<=num<=5000. If 'num' is outside that range, return "failed to convert". For this problem, you will use the common ancient interpretation of Roman Numerals such that the symbols used ONLY ADD to the total. The symbols should appear in strictly decreasing order of value. For example, the number 4 would be represented as "IIII" NOT as "IV". The number 1238 would be represented as "MCCXXXVIII". No other order is correct. Various symbols and their values are given below. You may assume that these are the only symbols to be used in the string (with the exception of the "fail to convert" message). I 1 V 5 X 10 L 50 C 100 D 500 M 1000 You might consider using helper methods (although I didn't). Look at the test data for examples.


test2021_11_04_HL_un(1) → "I"
test2021_11_04_HL_un(5000) → "MMMMM"
test2021_11_04_HL_un(71824) → "failed to convert"

...Save, Compile, Run (ctrl-enter)

public String test2021_11_04_HL_un(int num) { }

Editor font size %:
Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Java Help

Misc Code Practice

Difficulty: 280

Copyright Nick Parlante 2017 - privacy