Commit e9854241 authored by Trisha Gee's avatar Trisha Gee
Browse files

[Ch4] Renamed variables in Mixed messages exercise to be more consistent with modern Java

parent 632afcbd
Loading
Loading
Loading
Loading
+10 −10
Changes for src/main/java/ch4/Mix4.java: 10 added lines, 10 removed lines.
Original line number Diff line number Diff line
@@ -5,23 +5,23 @@ public class Mix4 {

  public static void main(String[] args) {
    int count = 0;
    Mix4[] m4a = new Mix4[20];
    int x = 0;
    Mix4[] mixes = new Mix4[20];
    int i = 0;
//    while () {
      m4a[x] = new Mix4();
      m4a[x].counter = m4a[x].counter + 1;
      mixes[i] = new Mix4();
      mixes[i].counter = mixes[i].counter + 1;
      count = count + 1;
      count = count + m4a[x].maybeNew(x);
      x = x + 1;
      count = count + mixes[i].maybeNew(i);
      i = i + 1;
//    }
    System.out.println(count + " "
                       + m4a[1].counter);
    System.out.println(count + " " +
                       mixes[1].counter);
  }

  public int maybeNew(int index) {
//    if (             ) {
      Mix4 m4 = new Mix4();
      m4.counter = m4.counter + 1;
      Mix4 mix = new Mix4();
      mix.counter = mix.counter + 1;
      return 1;
//    }
//    return 0;