Welcome to Our Last Class!

Announcements

  • Final Exam: Tuesday from 1:45pm to 3:45pm in this classroom!
    • No makeups - the exam must be taken on the day and at the time given
    • How to study: 
      • Final Exam Prep
      • Midterms
      • Quizzes
      • Review Activities
      • Programs (In and Out of Class)
    • Final will be cumulative from first day of class through today's lesson
    • Will draw heavily from the final exam prep
    • Will give you one of two programs on final exam prep
    • Will also select one method from your Methodical worksheets, and one method last night's Arrays and Methods worksheet
  • Will spend the first part of class doing review (~10-15min)
  • Second part of class will be final project presentations
  • Don't forget Lab 11
  • Office hours are over - no more late work or revisions will be accepted!

Review Activity

1. Given the following lines of code, write a loop to read in the file word by word:

String word;

int count = 0;

      File file = new File("in.txt");

Scanner input = new Scanner(file);

while(                                    ) {    

    word =

    count++;

    System.out.println("Word " + count + ": " + word);

}

2. Given the following lines of code, write a loop to read in the file line by line:


String line;

int count = 0;

      File file = new File("in.txt");

Scanner input = new Scanner(file);

while(                                ) {    

    line =

    count++;

    System.out.println("Line " + count + ": " + line);

}


3. Write a method to print an array of Strings to the console, with each element separated on its own line. The method should be named printArray. It takes an array of Strings as a parameter. It returns nothing.


4. Write the below method:



/**
    * Given an array of ints, return true if 10 appears as
    * either the first or last element in the array. The array will be size 1 or more.
    * first10Last([1, 2, 10]) → true
    * first10Last([10, 1, 2, 3]) → true
    * first10Last([13, 10, 1, 2, 3]) → false
    * @param data the array of integer values
    * @return whether or not 10 appears as the first or last element
    */
   


Final Project Presentations





~Good Luck Studying for the Final!~