id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

 

jebbert@volusia.k12.fl.us > test2021_02_25_APP1SLHL_passwordCheckSum
prev  |  next  |  chance

Write a method that returns the "checksum" of a given string. One way to store information about passwords without actually storing the password is to store a variety of characteristics about the password. One characteristic is the checksum. This is the sum of all the ASCII or UNICODE values of each character in the string. For example, the string "A" has a checksum of 65, because that is the ASCII value of "A". As a precondition, you may assume that the input parameter strings will only consist of characters who's ASCII values are the same as their UNICODE values (normal keyboard characters). This does NOT require ANY conditional statements such as 'if' or 'case' (but does require a condition in a for-loop). Note that chars are automatically converted to their ASCII values when stored in an integer variable.


test2021_02_25_APP1SLHL_passwordCheckSum("A") → 65
test2021_02_25_APP1SLHL_passwordCheckSum("B") → 66
test2021_02_25_APP1SLHL_passwordCheckSum("5") → 53

...Save, Compile, Run (ctrl-enter)

public int test2021_02_25_APP1SLHL_passwordCheckSum(String pswrd) { }

Editor font size %:
Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Java Help

Misc Code Practice

Difficulty: 220

Copyright Nick Parlante 2017 - privacy