Level 1 Checkpoint:

Module 2

1. Write a Constructor for a Cat object that sets its name and number of naps. (3)


public class Cat {

       private String name;
       private int napsPerDay;
















}


2. Name three JComponents. (3)

      ___________________________________________

      ___________________________________________

      ___________________________________________

3. Write a method that takes a person’s name as a parameter. If it’s your name, return “awesome”, otherwise return “lame”. (3)
















4. Create variables for the following: (4)

      The number of shoes you have

      The name of your favorite ice cream

      Whether you are going to the dance

      A JButton

      A Cat called Felix

___________________________________________

___________________________________________

___________________________________________

___________________________________________

___________________________________________



5. Write code to create strawberry jam and spread it on toast. (7)


public class Jam {

      String flavor;

       Jam(String flavor) {

              this.flavor = flavor;
       }

       void spreadOnToast() {

              System.out.println("Spreading "+flavor+“ jam on toast”);
      }
}