Computer Science 225
Advanced Programming
Spring 2022, Siena College
Agenda
You will submit responses to these by creating a shared Google document named "LastNameInClass2" in your CSIS225 shared folder.
Scanner kbd = new Scanner(System.in); System.out.print("Enter a number 1-10: "); int number = kbd.nextInt(); switch (number) { case 1: case 4: case 6: case 8: case 9: case 10: System.out.println(number + " is composite."); break; case 2: case 3: case 5: case 7: System.out.println(number + " is prime."); break; default: System.out.println(number + " is out of the allowed range (1-10)"); break; }
for (int i = 0; i < a.size(); i++) { int x = a.get(i); // do something with x }
if (numPeople == 1) { System.out.println("1 person attended the meeting."); } else { System.out.println(numPeople + " people attended the meeting."); }
Terminology
Examples