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

 

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

Write a method that accepts an array of ten names of digits, called 'names'. The index of this array matches the digit that the string names. For example, if 'names' element 0 is "zero" then we will call the digit 0 "zero". The idea of this method is that we can pass in an array containing the "normal" names for digits, or we can make up our own names for the digits. A number 'num' is also passed in, which will be non-negative. Return a string that names the digits of 'num' in order. For example, if our array uses the "normal" names for digits, and 'num' is 578, we would return "five seven eight". Notice that there is a space between each digit name, but no space at the end of the resulting string. Look at the test data for examples.


quiz2024_02_20_HL_digitNames(["zed", "own", "toe", "tree", "fer", "fyyve", "sox", "syvyn", "ate", "naan"], 128214) → "own toe ate toe own fer"
quiz2024_02_20_HL_digitNames(["zorp", "oit", "twy", "toop", "flanggy", "flig", "spooch", "slinept", "eweni", "nalaa"], 128093) → "oit twy eweni zorp nalaa toop"
quiz2024_02_20_HL_digitNames(["zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine"], 542) → "five four two"

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

public String quiz2024_02_20_HL_digitNames(String[] names, 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: 290

Copyright Nick Parlante 2017 - privacy