Public void start lotsofifs16 5 private void

This preview shows page 14 - 20 out of 20 pages.

public void start() { lotsOfIfs(16, 5); } private void lotsOfIfs(int value1, int value2) { System.out.print("A "); if (value1 < value2) { System.out.print("B "); value1 = 10; } else if (value2 < 10) { System.out.print("C "); if (value1 < 20) { System.out.print("D "); } value2 = value2 / 2; } if (value1 >= 6) { System.out.print("E "); value1 = 5; } else if (value2 >= 3) { System.out.print("F "); value2 = 5; } else { System.out.print("G "); value1 = value2; } System.out.println(value1 + " " + value2); } A C D E 5 2 (6 marks)
Image of page 14

Subscribe to view the full document.