Advertisement
Guest User

Untitled

a guest
Oct 16th, 2019
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.41 KB | None | 0 0
  1.  
  2.  
  3. public class Lab2Part3 {
  4.     public static void main(String[] args){
  5.      char[]myName = {'D','a','i','n','i','u','s'};
  6.  
  7.      System.out.println(calculateMyNameCharacterValue(myName));
  8.     }// end of main
  9.   public static int calculateMyNameCharacterValue(char[] name) {
  10.      int total = 0;
  11.      for(int i = 0; i< name.length;i++){
  12.          total = total + name[i];
  13.      }
  14.      return total;
  15.   }
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement