Duplicating words
1. Read 10 words from the keyboard and add them to a list of strings.
2. The doubleValues method should duplicate words like this:
alpha, beta, gamma, -> alpha, alpha, beta, beta, gamma, gamma.
3. Display the result, each value on a new line.
Requirements:
1. Declare string list variable and immediately initialize it.
2. Read 10 lines from the keyboard and add them to the list.
3. The doubleValues method should duplicate elements of the list like this: alpha, beta, gamma, -> alpha, alpha, beta, beta, gamma, gamma.
4. Display the resulting list, each element on a new line.
Joyonta Saha
Level 31
Can anyone please give a demo what will be inputs and outputs because the conditions are bit confusing?
Resolved
Comments (2)
- Popular
- New
- Old
You must be signed in to leave a comment
Joyonta Saha
29 August 2018, 16:58
Thank you Roman for your hints.
0
Roman
27 August 2018, 12:39solution
For example:
1. Read 10 words from the keyboard
one
two
three
and add them to a list of strings.
2. The doubleValues method should duplicate words like this:
alpha, beta, gamma, -> alpha, alpha, beta, beta, gamma, gamma.
/*your logic*/
3. Display the result, each value on a new line.
one
one
two
two
three
three
+4