Question: Write a Code in C++/Java (preferably C++) Please READ the instructions carefully in the picture. You will be given an input file ( link is

Write a Code in C++/Java (preferably C++)

Please READ the instructions carefully in the picture.

You will be given an input file (link is here -> https://www.dropbox.com/s/444jofkchu6ylwrames.txt?dl=0 ) this file is a .txt (text) file that contains over 5,000 names that have already been arranged in alphabetical order for you. What you have to do is compute an alphabetical value for each name where A is1, B is 2, C is 3 and so on. Alphabetical value of a name is just the sum of the values of the letters in the name. To compute the name-score for a name, you simply have to mulitply this alphabetical value by its position in the sorted list.

For example: when the list is sorted into alphabetical order, COLIN, which is worth 3 + 15 + 12 + 9 + 14 = 53, is the 938th name in the list. C - 3 O - 15 L - 12 I - 9 N - 14

So, the name-score for COLIN would be 938 * 53 = 49714. What is the sum total of all the name-scores in the file?

Write a Code in C++/Java (preferably C++) Please READ the instructions carefully

Scoring Names You will be using the provided names.txt file, text file containing over five-thousand first names, and you will calculate a score for each name. Begin by reading the names from the file and sorting them in alphabetical order. Then, you will compute an alphabetical value for each name where A is 1, Bis 2, C is 3 and so on. The alphabetical value of a name is just the sum of the values of the letters in the name. To compute the name-score for a name, you simply multiply this alphabetical value by its position in the sorted list. For example, when the list is sorted into alphabetical order, COLIN, which is worth 3 15 12 9 14 53, is the 938th name in the list. So, the name-score for COLIN would be 938 53 49714. What is the sum total of all the name-scores in the file

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!