Mishakis

VowelSum

Aug 2nd, 2017
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.95 KB | None | 0 0
  1. package com.company;
  2.  
  3. import com.sun.org.apache.xpath.internal.SourceTree;
  4.  
  5. import java.time.chrono.MinguoEra;
  6. import java.util.Scanner;
  7.  
  8. public class Main {
  9.  
  10.     public static void main(String[] args) {
  11.         Scanner scanner = new Scanner(System.in);
  12.  
  13.        String word = scanner.nextLine();
  14.        int sum=0;
  15.  
  16.         for (int i = 0; i < word.length() ; i++) {
  17.          
  18.             char symbol = word.charAt(i);
  19.             switch(symbol){
  20.                 case 'a':
  21.                     sum += 1;
  22.                     break;
  23.                 case 'e':
  24.                     sum += 2;
  25.                     break;
  26.                 case 'u':
  27.                     sum += 5;
  28.                     break;
  29.                 case 'i':
  30.                     sum += 3;
  31.                     break;
  32.                 case 'o':
  33.                     sum += 4;
  34.                     break;
  35.  
  36.             }
  37.  
  38.         }
  39.         System.out.println(sum);
  40.  
  41.     }
  42. }
Advertisement
Add Comment
Please, Sign In to add comment