Programming Tools & Computer Science I

CSC 185 & 201, Spring 2013, Northern Virginia Community College

Week 16: exam review

2013-05-06

Our final exam (on Wednesday, May 8) will cover all the major topics from the semester. The main new topics since the last exam include:

See this old exam for some example problems and an example of the format (exact topics covered may differ slightly). More example problems are below.

Example problems

  1. The function Integer.parseInt takes a String as input and returns the int value it represents (for example, 15 → 15). It throws a NumberFormatException if the input cannot be converted to an int. Write code that will repeatedly prompt the user to input a number until the input can successfully be converted to an int.
  2. Define a class GreetingCounter that extends the class shown below so that it has a method int helloCount() that returns the number of times the hello method has been called.
    class Greeting {
        private String name;
        public Greeting(String name) { this.name = name; }
        public void hello() { System.out.println("Hello " + name + "!"); }
    }