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

 

abraskin@mbusd.org > vowelSum
prev  |  next  |  chance

Given a string, calculate and return a sum where each vowel has the following value: a=1, e=2, i=3, o=4, u=5. Capital vowels are worth double. Examples: "Hello" has an e worth 2, and an o worth 4 for a total value of 2+4=6. "Nyx" has no vowels so it has a value of 0. "Aaron" has a capital A worth 2, and a lowercase a worth 1, and an o worth 4 for a total value of 2+1+4=7.


vowelSum("Hello") → 6
vowelSum("Nyx") → 0
vowelSum("Aaron") → 7

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

public int vowelSum(String s) { }

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: 250 Post-solution available

Copyright Nick Parlante 2017 - privacy