advictoriam

Untitled

Nov 22nd, 2018
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.58 KB | None | 0 0
  1. public class AverageTester
  2. {
  3.    public static void main(String[] args)
  4.    {
  5.       String word1 = "Mary";
  6.       String word2 = "had";
  7.       String word3 = "a";
  8.       String word4 = "little";
  9.       String word5 = "lamb";
  10.  
  11.       double length1 = word1.length();
  12.       double length2 = word2.length();
  13.       double length3 = word3.length();
  14.       double length4 = word4.length();
  15.       double length5 = word5.length();
  16.       double average = (length1 + length2 + length3 + length4 + length5)/5;
  17.       System.out.println(average);
  18.       System.out.println("Expected: 3.6");
  19.    }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment