Adding Numbers to get a single Number

November 9, 2011 at 08:13:26
Specs: Windows 7, i5/4Gb
Hi,I am looking for a batch script to take input from a text file(Names.txt) having names & last names and converting each names & last names "alphabets" to its predefined below shown "numeric" value and then adding this numeric value to finally get ONE digit numeric value.

To make it more clear I would like to explain with an example .The Mapping between "Alphabets" & "Number" which I'll be using is as below.

"a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u","v", "w", "x", "y", "z"
"1", "2", "3", "4", "5", "8", "3", "5", "1", "1", "2", "3", "4", "5", "7", "8", "1", "2", "3", "4", "6", "6", "6", "5", "1","7"

Rozer Gorth =>Equivalent Numeric value: 2775237245 ==>Individually adding each number(2+7+7+5+2+3+7+2+4+5): 44 ==> Final ONE numeric digit(4+4): 8
Jimy Dacy =>Equivalent Numeric value: 11414131 ==>Individually adding each number(1+1+4+1+4+1+3+1): 16 ==>Final ONE numeric digit(1+6): 7
Peter Pace =>Equivalent Numeric value: 854522135 ==>Individually adding each number(8+5+4+5+2+2+1+3+5): 35 ==>Final ONE numeric digit(3+5): 8

So result will be dumped into another file(Result.txt) as

Rozer Gorth : 8
Jimy Dacy : 7
Peter Pace : 8

I shall be very thankful for any suggestion and help.


See More: Adding Numbers to get a single Number

Report •


#1
November 9, 2011 at 12:48:35
Batch is more difficult than a small program.

Report •

#2
November 10, 2011 at 02:16:22
yes i know , but in java if you can help me out.

Report •

Related Solutions


Ask Question