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

 

HPCW2020_06_MartianNumerals


Martian Numerals
Problem 06
Worth 4 points

How many X's did a Roman Centurion make a day in cold hard Lira? About a C's worth! Turns out, Martians
gave Rome the idea for their number system. Use the conversion charts below to help translate some Martian
numbers!

Note, that unlike the Roman Numerals, Martian Numerals reuse symbols to mean different values. B can either
mean '1' or '100' depending on where it appears in the number sequence.

B's and W's and Z's, oh my!

Arabic  1 2  3   4  5 6  7   8    9  10 20 30  40  50 60 70
Martian B BB BBB BW W WB WBB WBBB BK Z  ZZ ZZZ ZP  P  PZ PZZ

Arabic  80   90 100 200 300 400 500 600 700 800  900 1000
Martian PZZZ ZB B   BB  BBB BG  G   GB  GBB GBBB BR  R

You will need to convert the numbers from Arabic (1,2,3...10...500...1000) to Martian (B,BB,BBB...Z...G...R) numerals.

HPCW2020_06_MartianNumerals(26) → "ZZWB"
HPCW2020_06_MartianNumerals(999) → "BRZBBK"
HPCW2020_06_MartianNumerals(67) → "PZWBB"

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

public String HPCW2020_06_MartianNumerals(int n) { }

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

Post-solution available

Copyright Nick Parlante 2017 - privacy