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

 

abraskin@mbusd.org 2015_quarter_exam_practice > asteriskOverflow
prev  |  next  |  chance

Add each digit from two positive integers and store the result in a String in the same order. If the sum of two digits exceeds 9 then put an asterisk in that digit's location in the String instead.


For example, 5366 and 5161 combine to become *4*7 because:

The two one's digits combine to equal 7 and become the first digit in the String, while the two ten's digits combine to be more than 9 so there is an asterisk instead of a number. The two numbers in the 100's place combine to equal 4 while the 1000's digits add up to 10 so there is an asterisk there instead.

asteriskOverflow(9999999, 1010101010) → "1019*9*9*9"
asteriskOverflow(5366, 5161) → "*4*7"
asteriskOverflow(1, 123) → "124"

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

public String asteriskOverflow(int a, int b) { }

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: 299

Copyright Nick Parlante 2017 - privacy