﻿1;2401;0c﻿ CS 1110/1111: Introduction to Programming

# Lecture 22

## Announcements

Guest lecturer! Thanks to Jim, Monika, and Casey for letting the Prof.s attend an CS education conference today.

HW5 will start after the break and will be done in pairs.

• You partner must be from your lab section.

• Pair Programming: you'll have to work together so pick someone with a compatible schedule.

• You'll have a different partner for HW6. You cannot re-use partners.

• You can generally pick your partner, but your lab TA has the final say.

## Talking Points

### Humans > Methods

Anything a method can do, a human can do.

```public class Volunteers {
public static in add(int a, int b) {
return a + b;
}
public static void write(int a) {
Write the number on the "console"
}
public static int nextInt() {
int x = the first number in the "console"
erase the first number in the "console"
return x;
}
public static void erase() {
erase everything in the "console"
}
}```

We'll use this to play around with what method invocations do.

### Coding

We'll write several methods and talk about them. These might include:

• `isBigger(int a, int b)` that tells whether `a` is bigger than `b` or not (code to be added during/after class).

• `printArray(String[] s)` that prints an array of strings to `System.out`.

• `stringOf(String[] s)` that creates a `String` representing the contents of an array.

• `findBiggest(double[] list)` that finds the biggest element of a list.

• `scaleMaxTo1(double[] list)` that scales the elements of a list so that the largest value is 1.

Code from 1pm