PROBLEM - FORMULA FOR SUCCESS Back in your elementary days you may have seen posters which say that if each letter of the alphabet had an ordinal number value (A = 1, B = 2, C = 3, and so on), then their words can be the sum of those letters which hold the formula for success. LUCK can only get you 47% while MONEY only gets you to 72%. KNOWLEDGE gets you to 96%, LEADERSHIP to 97%, and HARDWORK to 98%. But they say the greatest formula for success is ATTITUDE which gets you to 100%. Create a program that takes in a word and checks each letter to build up a sum similar to the one mentioned above. Input Format The only line of input will contain a string s which is the word to be checked letter by letter. The input will always be entered in uppercase letters Output Format The only line of output will be the sum of the word entered. Sample input / output LEADERSHIP 97 Explanation Since we treat each letter of the input as if it were a number, then we can treat the word as a sum of those numbers represented by each letter. Therefore, LUCK is 12+21+3+11 = 47%, KNOWLEDGE is 11+14+15+23+12+5+4+7+5 = 96% and ATTITUDE IS 1+20+20+9+20+21+4+5 = 100%. To turn individual characters into numbers, you can use the following code: char a = "A'; int letterValue - a - 64; // substitute 'A' as needed by the problem // Subtracting 64 gives us the numerical equivalent
PROBLEM - FORMULA FOR SUCCESS Back in your elementary days you may have seen posters which say that if each letter of the alphabet had an ordinal number value (A = 1, B = 2, C = 3, and so on), then their words can be the sum of those letters which hold the formula for success. LUCK can only get you 47% while MONEY only gets you to 72%. KNOWLEDGE gets you to 96%, LEADERSHIP to 97%, and HARDWORK to 98%. But they say the greatest formula for success is ATTITUDE which gets you to 100%. Create a program that takes in a word and checks each letter to build up a sum similar to the one mentioned above. Input Format The only line of input will contain a string s which is the word to be checked letter by letter. The input will always be entered in uppercase letters Output Format The only line of output will be the sum of the word entered. Sample input / output LEADERSHIP 97 Explanation Since we treat each letter of the input as if it were a number, then we can treat the word as a sum of those numbers represented by each letter. Therefore, LUCK is 12+21+3+11 = 47%, KNOWLEDGE is 11+14+15+23+12+5+4+7+5 = 96% and ATTITUDE IS 1+20+20+9+20+21+4+5 = 100%. To turn individual characters into numbers, you can use the following code: char a = "A'; int letterValue - a - 64; // substitute 'A' as needed by the problem // Subtracting 64 gives us the numerical equivalent
Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
Related questions
Question
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 3 steps with 3 images
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY