//weirdest lab yet... //tallies male (wackets), female (wockets), and group(widgets) gremlin counts //three additional classes (files) run this main program //excessively long because constructing print methods is annoying import cs1.Keyboard; public class WidgetApp { public static void main(String[] args) { Wacket wacket1, wacket2; Wocket wocket1, wocket2; Widget widget1, widget2; double weight, mWeight, fWeight, something, fWeight1, wockWeight, mWeight1, groupWeight; int count, mCount, fCount, wockCount, fCount1, mCount1, eC, groupSize; System.out.println(); System.out.println("Wackets:"); System.out.print("Count: "); count = Keyboard.readInt(); eC = 0; while (eC < Keyboard.getErrorCount()) { System.out.print("Count: "); count = Keyboard.readInt(); eC++; } System.out.print("Weight: "); weight = Keyboard.readDouble() * count; while (eC < Keyboard.getErrorCount()) { System.out.print("Weight: "); weight = Keyboard.readDouble(); eC++; } wacket1 = new Wacket(count, weight); System.out.println(); System.out.print("Count: "); count = Keyboard.readInt(); while (eC < Keyboard.getErrorCount()) { System.out.print("Count: "); count = Keyboard.readInt(); eC++; } System.out.print("Weight: "); weight = Keyboard.readDouble() * count; while (eC < Keyboard.getErrorCount()) { System.out.print("Weight: "); weight = Keyboard.readDouble(); eC++; } wacket2 = new Wacket(count, weight); System.out.println(); System.out.println("Wockets:"); System.out.print("Count: "); wockCount = Keyboard.readInt(); while (eC < Keyboard.getErrorCount()) { System.out.print("Count: "); wockCount = Keyboard.readInt(); eC++; } System.out.print("Weight: "); wockWeight = Keyboard.readDouble() * wockCount; while (eC < Keyboard.getErrorCount()) { System.out.print("Weight: "); wockWeight = Keyboard.readDouble(); eC++; } wocket1 = new Wocket(wockCount, wockWeight); System.out.println(); System.out.print("Count: "); wockCount = Keyboard.readInt(); while (eC < Keyboard.getErrorCount()) { System.out.print("Count: "); wockCount = Keyboard.readInt(); eC++; } System.out.print("Weight: "); wockWeight = Keyboard.readDouble() * wockCount; while (eC < Keyboard.getErrorCount()) { System.out.print("Weight: "); wockWeight = Keyboard.readDouble(); eC++; } wocket2 = new Wocket(wockCount, wockWeight); System.out.println(); System.out.println("Widgets:"); System.out.print("Male Count: "); mCount1 = Keyboard.readInt(); while (eC < Keyboard.getErrorCount()) { System.out.print("Male Count: "); mCount1 = Keyboard.readInt(); eC++; } System.out.print("Male Weight: "); mWeight1 = Keyboard.readDouble() * mCount1; while (eC < Keyboard.getErrorCount()) { System.out.print("Male Weight: "); mWeight1 = Keyboard.readDouble(); eC++; } System.out.print("Female Count: "); fCount1 = Keyboard.readInt(); while (eC < Keyboard.getErrorCount()) { System.out.print("Male Count: "); fCount1 = Keyboard.readInt(); eC++; } System.out.print("Female Weight: "); fWeight1 = Keyboard.readDouble() * fCount1; while (eC < Keyboard.getErrorCount()) { System.out.print("Male Weight: "); fWeight1 = Keyboard.readDouble(); eC++; } System.out.println(); widget1 = new Widget(mCount1, mWeight1, fCount1, fWeight1); System.out.print("Male Count: "); mCount = Keyboard.readInt(); while (eC < Keyboard.getErrorCount()) { System.out.print("Male Count: "); mCount1 = Keyboard.readInt(); eC++; } System.out.print("Male Weight: "); mWeight = Keyboard.readDouble() * mCount; while (eC < Keyboard.getErrorCount()) { System.out.print("Male Weight: "); mWeight = Keyboard.readDouble(); eC++; } System.out.print("Female Count: "); fCount = Keyboard.readInt(); while (eC < Keyboard.getErrorCount()) { System.out.print("Female Count: "); fCount = Keyboard.readInt(); eC++; } System.out.print("Female Weight: "); fWeight = Keyboard.readDouble() * fCount; while (eC < Keyboard.getErrorCount()) { System.out.print("Male Weight: "); fWeight = Keyboard.readDouble(); eC++; } System.out.println(); widget2 = new Widget(mCount, mWeight, fCount, fWeight); System.out.print("Wacket 1: "); System.out.println(wacket1); System.out.print("Wacket 2: "); System.out.println(wacket2); System.out.print("Wocket 1: "); System.out.println(wocket1); System.out.print("Wocket 2: "); System.out.println(wocket2); System.out.print("Widget 1: "); System.out.println(widget1); System.out.print("Widget 2: "); System.out.println(widget2); System.out.println(); System.out.print("Weight of one female: "); wocket1.add(Keyboard.readDouble()); System.out.print("Count of female group: "); groupSize = Keyboard.readInt(); System.out.print("Average weight for the group: "); groupWeight = groupSize * Keyboard.readDouble(); wocket2.add(groupSize, groupWeight); System.out.print("Weight of one male: "); wacket1.add(Keyboard.readDouble()); System.out.print("Count of male group: "); groupSize = Keyboard.readInt(); System.out.print("Average weight for the group: "); groupWeight = Keyboard.readDouble() * groupSize; wacket2.add(groupSize, groupWeight); System.out.println(); System.out.print("Wocket 1 after adding one female: "); System.out.println(wocket1); System.out.print("Wocket 2 after adding a female group: "); System.out.println(wocket2); System.out.print("Wacket 1 after adding one male: "); System.out.println(wacket1); System.out.print("Wacket 2 after adding male group: "); System.out.println(wacket2); System.out.println(); wacket1.add(wacket2); wocket1.add(wocket2); System.out.print("Wacket 1: "); System.out.println(wacket1); System.out.print("Wacket 2: "); System.out.println(wacket2); System.out.print("Wocket 1: "); System.out.println(wocket1); System.out.print("Wocket 2: "); System.out.println(wocket2); System.out.print("Widget 1: "); System.out.println(widget1); System.out.print("Widget 2: "); System.out.println(widget2); System.out.println(); widget1.add(wocket1); System.out.print("Widget 1 after adding wocket 1: "); System.out.println(widget1); widget2.add(wacket1); System.out.print("Widget 2 after adding wacket 1: "); System.out.println(widget2); widget1.add(widget2); System.out.print("Widget 1 after adding widget 2: "); System.out.println(widget1); System.out.println(); System.out.print("Wacket 1: "); System.out.println(wacket1); System.out.print("Wacket 2: "); System.out.println(wacket2); System.out.print("Wocket 1: "); System.out.println(wocket1); System.out.print("Wocket 2: "); System.out.println(wocket2); System.out.print("Widget 1: "); System.out.println(widget1); System.out.print("Widget 2: "); System.out.println(widget2); } }