public static void main() { // declare array of names - allow up to 100 // need to know how many are actually on the roster // print names (one per line) ... // Read names from user: // enter names until enter "END" // is "Jane Doe" in names? // is arbitrary person in names? // count number of "Jane Doe" entries in names list }
double[] temps = new double[30]; ... int daysFreezing = 0; for(double dayTemp : temps) if ( dayTemp < 0.0 ) // celsius! daysFreezing++;
for(String n : names) System.out.println(n);
public class Planet { private double habitableArea; private long population; public Planet(double habitableArea) { this.habitableArea = habitableArea; } public long getPopulation() { return population; } public double populationDensity() { return population / habitableArea; } public boolean isSparse() { return populationDensity() < 1.0; } }
ArrayList<Integer> rooms = new ArrayList<Integer>();