Purchase Solution

Java program

Not what you're looking for?

Ask Custom Question

Write a program that reads a social security number written as contiguous digits (for instance, 509435456), uses the charAt method to obtain each character and then prints each digit on a separate line followed by a colon and the digit printed the number of times equal to its value. Thus the output for 509435456 would be
5:55555
0:
9:999999999
4:4444
3:333
5:55555
4:4444
5:55555
6:666666

Hint: Use a char variable,e.g., index, for the inner loop control variable and write the inner loop as for(char index = '1'; index <= digit; index++) where digit is the char variable used to store the digit taken from the string.

Purchase this Solution

Purchase this Solution


Free BrainMass Quizzes
Inserting and deleting in a linked list

This quiz tests your understanding of how to insert and delete elements in a linked list. Understanding of the use of linked lists, and the related performance aspects, is an important fundamental skill of computer science data structures.

Basic Networking Questions

This quiz consists of some basic networking questions.

Java loops

This quiz checks your knowledge of for and while loops in Java. For and while loops are essential building blocks for all Java programs. Having a solid understanding of these constructs is critical for success in programming Java.

Word 2010: Table of Contents

Ever wondered where a Table of Contents in a Word document comes from? Maybe you need a refresher on the topic? This quiz will remind you of the keywords and options used when working with a T.O.C. in Word 2010.

Basic Computer Terms

We use many basic terms like bit, pixel in our usual conversations about computers. Are we aware of what these mean? This little quiz is an attempt towards discovering that.