Frontier Computer Science

 

Programming

Page history last edited by Ms. Evans 1 yr ago

Programming

 

May 6, 2007

 

Class Work:

    Who wants to be a millionaire final project

 

Home Work:

    Study for the final on May 15 (next Thursday).  Practice Javabat problems with paper and pencil.

   

 

April 29, 2007

 

Class Work:

    Finish Hangman

    Blackjack

 

Home Work:

    Finish Hangman Program

    Finish Deal and Hit methods

 

April 22, 2007

 

Class Work:

 

 

 

    Review of Java:

Variables:

    Types:

        int - integer

        char - character

        String - holds words and sentences

        double - holds floating point numbers (decimals)

    Legal Names:

        Must begin with a letter

        Cannot have spaces

        Only punctuation allowed is the underscore _

    Naming Style (either is acceptable):

        theName - squish everything together.  First word starts with lower-case letter.  Other words start with upper-case letters

        the_name - everything is lower-case.  Separate words with underscore _

    Assigning a Value

        int num = 5;

        double num2 = 3.4;

        String word = "Cat";  (Notice the double quotes)

        char letter = 'a'; (Notice the single quotes)

 

 Operators:

    + Addition

    -  Subtraction

    * Multiplication

    /  Division

    % Modulus (Finds the remainder.  7%4 = 3)

 

    ++ Adds one to the preceding variable.  For example int num = 3; num++;  Now num equals 4.

     --  Subtracts one from the preceding variable.

    += Adds the value to the preceding varialbe.  For example int num =3; num+=4; Now num equals 7.

     -= Subtracts the value from the preceding variable.

 

Input:

    import java.util.*;

    import java.io.*;

    Scanner myScan = new Scanner(System.in);

    int num = myScan.nextInt();  //A nextLine() should follow EVERY nextInt.

    myScan.nextLine();

 

Boolean Expressions:

    <   Less Than

    >   Greater Than

    >= Greater Than or Equal To

    <= Less Than or Equal To

    =    Assign a value to a variable.  For example, num=3.

    == Compares two values.  For Example, if (num == 3).

    !     Not.  For Example, if (!available())

    !=  Not Equal.  For Example, if (num != num2)

    && And

    ||   Or

 

    A       B    A && B    A || B    !B

    T       T        T              T          F

    T       F        F              T          T

    F       T        F              T   

    F       F        F              F   

 

If Statement:

    Requires curly braces following it if there is more than one line of code.  For Example:

            if (true)

                return true;   //This is legal.

            ---------------------------------------

            if (true)

                isAvailable();

                return true;   //This is the same as below.

 

            if (true)

            {

                isAvailable();

            }

            return true;

 

    If statements do not have to have an else statement

 

For Loop:

 

    for(initial; condition; update)

    {

        code

    }

 

    Example:

    for (int i=0; i<10; i++)

    {

       System.out.print("*");

    }

    //This prints 10 stars - **********

 

Arrays:

 

    Declare an array: int numbers[] = new int[100];

 

    numbers[0] = 7; //first element is set to 7 (arrays start at 0)

 

    numbers[100] = 56; //NOT LEGAL!  The last index of the array is 99.

 

    Use a loop to access the array.

        for(int i=0; i<100; i++)

        {

            System.out.print("Enter a number: ");

            numbers[i] = myScan.nextInt(); //i is used to index into the array

        } //This loop allows the user to enter 100 numbers.

 

 

 

Hangman

 

Create a hangman game. Let the computer pick (randomly) a word from a string array and let the user guess that word. Count the right and wrong guesses. Let the user lose if it took him more than 5 wrong guesses. 

 

Challenge

Create and update a picture of the hangman using ASCII Art

 

 

Home Work:

 

  5 Stars in the Array 1 Category of Javabat

 

April 17, 2007

 

Class Work:

     Work on the Apartment Program

 

Home Work:

    Finish the Apartment Program.  Add if statements to the menu entries to check that the user has input a valid apartment number.  If the apartment number is invalid, print an error and return to the menu.  If the apartment number is valid, complete the task.

 

    5 Stars in the Array 1 Category of Javabat need to be completed by April 24 (next Wednesday).

 

April 15, 2007

 Class Work:

  Work on the Soccer Roster Program

 

Home Work:

    Finish Soccer Roster

 

March 24, 2007

 

Bell Work:

 Take out your Raffle Ticket Packet

 

Class Work:

  Work on the Raffle Ticket Driver

 

March 20, 2007

 

Class Work:

  More on Arrays

  Raffle Project

 

March 18, 2007

 

Bell Work:

 Review for the Test

 Ask any questions that you have

 

Class Work:

  Test

Arrays

  1. Declare and Initialize
    1. int [ ] nums = new int [20];//creates an array called nums that holds 20 nums with indexes from 0 to 19
    2. int [ ] nums = {0, 4, 9,15, 42, -6, 2};

 

  1. Length
    1. int len = nums.length;  //sets an int variable called len to equal the length of the nums array

 

  1. Access an array slot
    1. nums[5] = 15; //stores 15 in the 5 slot of the array
    2. if (nums[5]==4)  //an if statement to see if the value in slot 5 equals 4

 

  1. Access the first slot of an array
    1. nums[0] //slot 0 is always the first in an array

 

  1. Access the last slot of an array
    1. nums[nums.length-1] //the last slot of an array is always at the length - 1 because the slots start counting at 0 instead of 1

 

 

Home Tasks:

 

March 13, 2007

 

Class Work:

 

Home Tasks:

  Study for the Test on Tuesday:

       Loops (Chapter 11)

       String Methods (Chapter 3 and Javabat)

       Graphics with Drawing Panel and the Graphics Class

       Loops with Graphics

 

March 11, 2007

 

Class Work:

   Graphics Loops

 

Challenge:

 

Home Tasks:

 

March 6, 2007

 

Class Work:

   Finish Quilt Project

   Nested Loops  

   Start Graphics Class

 

 

Home Tasks:

Recreate the Butterfly using colors of your choice

 

March 4, 2007

 

Class Work:

   Start the Quilt Project

       - Complete the target square

       - Complete two other squares of your choice

 

Home Tasks:

 

February 28, 2007

 

Class Work:

   Review Homework

   Celebrity Project

   www.javabat.com

 

Home Tasks:

 

February 26, 2007

 

Class Work:

   String Methods

    www.javabat.com

 

Home Tasks:

    Chapter 3: 1-12

 

February 21, 2007

 

Class Work:

   Review Tests

   For Loop Practice

   Review Letter Class

   Voting Machine Project

 

Home Tasks:

    Finish the Letter Class.

  •     Allow the user to enter information for 3 students and print 3 letters.
  •     Add a field to specifiy what the student's grade in the given course is.  The grade should be a percent.
  •     Challenge:
    • Create a student class that holds the name, grade and course.
    • Use an arrayList to generate all the letters.

February 19, 2007

Bell Work:

    Review for the Test

 

Class Work:

    For Loop Test

    Main Method

    Input

 

Home Tasks:

    Finish the Letter Class.

  •     Allow the user to enter information for 3 students and print 3 letters.
  •     Add a field to specifiy what the student's grade in the given course is.  The grade should be a percent.
  •     Challenge:
    • Create a student class that holds the name, grade and course.
    • Use an arrayList to generate all the letters.

February 12, 2007

Bell Work:

    Review Homework 

 

Class Work:

    For Loop Practice

    Be the JVM

    Code Magnets

    Discuss Main Method

    Random Numbers?

 

Home Tasks:

 

 

February 7, 2007

Bell Work:

 

Class Work:

    More on For Loops

 

Home Tasks:

    Chapter 11 #910-14

 

February 5, 2007

Bell Work:

    Review for the Quiz

 

Class Work:

         Review the Locker Class

         Intro to For Loops

 

 

Home Tasks:

    Chapter 11 in Blue Pelican Java: #1-9

 

 

January 31, 2007

Bell Work:

    Get your Blue Pelican Java Book from your Locker.

 

Class Work:

         Review the jelly bean class

         Write Piggie Bank Class

 

Create a Binder class with a title, pages and dividers.  Create accessors and mutators

 

Create a Locker class with add and remove methods.  It should also have:

 

  •     public void numOfBinders() //Prints the number of binders in the locker
  •     public boolean isEmpty() //Returns true if the locker is empty, otherwise return false
  •     public void getPages(Binder myBinder) //prints the number of pages in the binder that is given as a parameter
  •      public void getDividers (Binder myBinder) //prints the number of dividers in the binder that is given as a parameter

 

 

Home Tasks:

 

    Study for quiz

          -Write a class

          -Create an arrayList

          -Add something to the arrayList

          -Remove something from the arrayList (using indexOf)

 

January 29, 2007

Bell Work:

    Get your Blue Pelican Java Book from your Locker.

 

Class Work:

         Review the Closet Class

         Library Project

 

Jelly Bean Problem

Mr. Smith loved to make Jelly Beans, but he always made a new flavor!

 

Every Jelly Bean was a different flavor from the other beans.  Every Jelly Bean had a color and a flavor.

 

Write a program that will store all of Mr. Smith's different jelly beans.

 

Mr. Smith wants to do all of these things:

  • Add new flavors
  • Remove flavors that his daughter eats
  • See a list of the flavors he has
  • Find the number of the location where each jelly bean is stored

Home Tasks:

 

 

January 24, 2007

Bell Work:

    Open your Notebook Class

 

Class Work:

          Create an Addressbook class that has an ArrayList of Strings called Names.  Create the following methods: 

 

                public void addName(String newName)

                public void viewName(int nameToView)

                public void removeName(int nameToRemove)

                public void listNames()

 

Home Tasks:

 

    Write a Shirt class that has the following fields:

          size (int)

          color (String)

          isDressCode (boolean)

    Write an accessor and mutator for each of the fields.  The constructor should set all three fields to the value of parameters.

 

    Write a Closet class that has an arrayList of shirts.  Create the following methods:

 

          public void addShirt (Shirt newShirt)

          public void removeShirt(int shirtNum)

          public void viewSize(int shirtNum)

 

January 22, 2007

Bell Work:

 

Class Work:

  • Hand back Tests
  • Review Bank and Gas Mileage
  • Review Homework
  • Calculator Program

 

 Write a class called playerStats that keeps track of a soccer player’s game statistics.  There are four fields (all are doubles): gamesAttended, gamesPlayed, goals and assists.  The constructor should take 4 parameters that are used to set the values of the four fields.  Create an accessor and a mutator for each of the fields.

 

 

Create methods from each of the following method signatures:

 

 

public double averageGoals()

Calculates the average number of goals scored per game using gamesPlayed and goals.

 

 

public double averageAssists()

Calculates the average number of assists per game using gamesPlayed and assists.

 

 

public double percentGamesPlayed()

Calculates the percent of games that the player actually played in using gamesAttended and gamesPlayed.

 

 

public void printStats()

Prints the average number of goals, average number of assists and percent of games that were played.

 

Home Tasks:

 

 

January 17, 2007

Bell Work:

 

Class Work:

  • Test
  • Finish Clocks
    • Objects Creating Objects
    • Multiple Constructors
    • Internal Method Calls
    • External Method Calls

Home Tasks:

 

January 15, 2007

Bell Work:

 

Class Work:

  • Review Homework
  • Review for Quiz
    • Class Diagrams (static view)
    • Object Diagrams (dynamice view)
    • &&
    • ||
    • !
    • Concatenation (Know when to use quotes!)
    • Modulo
  • Bank and Gas Mileage Problems
  • Finish Clock?

 

Home Tasks:

 

 

January 10, 2007

Bell Work:

 

Class Work:

  •  Clock Project
  • Modulo
  • If Statements
  • Boolean Logic
  • Class and Object Diagrams

 

Home Tasks:

  •  Write an expression using boolean variables a and b that evaluates to true when only one of a and b is ture, and which is false if a and b are both false or both true
  • Consider the expression (a&&b).  Write an equivelent expression (one that evaluates to true at exactly the same values for a and b) without using the && operator.
  • What are all the possible results of the expression ( n % 5), where n is an integer?
  • What are all the possible results of the expression ( n % m) where n and m are integers?
  • Rewrite the increment method without the modulo operator using an if statement.
    • Here is the increment method:
    •  

public void increment()

{   

value = (value+1)%limit;

}

 

 

January 8, 2007

Bell Work:

 

 

Class Work:

  • Review Classes
  • Conditional Statements

 

Home Tasks:

    Define a Store class which represents a school store.  A Store has a name (String), a candyAmount (int), and a candyPrice (double).  The class has the following methods.

 

1. Constructor – Takes a nameValue, candyAmountValue, and candyPriceValue as parameters and initializes the fields accordingly.

 

2. getName – an accessor method for the name field

 

3. getCandyAmount – an accessor method for the candyAmount field

 

4. getCandyPrice– an accessor method for the candyPrice field

 

5. setName– an mutator method for the name field

 

6. setCandyAmount– an mutator method for the candyAmount field

 

7. setCandyPrice– an mutator method for the candyPrice field

 

8. increaseAmount – Increases the candyAmount by one

9. buyMore - a boolean method that returns true if the candyAmount is less than 10.  Otherwise returns false.

 

December 20, 2007

Bell Work:

    Crossword Puzzle

 

Class Work:

    Robomind

 

Home Tasks:

    Have a great holiday!

 

December 13, 2007

Bell Work:

    Take out your homework

 

Class Work:

 

    Mutators, Accessors, and Printing

 

    Be sure to know these things for the final exam:

  • Class Declarations
  • Field Declarations
  • Constructors
  • Mutators
  • Accessors
  • Print Methods
  • Alice
    • Control Structure
    • Event Handler
    • If/Else Statement
    • Event
    • Functions
    • Argument
    • Event Trigger
    • Divide and Conquer
    • Count-Controlled
    • Variables
    • Parameter
    • Conditional
    • Classes
    • Loop
    • Method

 

Home Tasks:

Study for the final!

 

 

December 11, 2007

Bell Work:

    Open the classes you completed on Thursday.

 

Class Work:

 

    Bluej Chapter 2 Part III

 

Home Tasks:

Worksheet 2.74, 2.76, and 2.78 (be sure to pay attention to ALL the code needed in 2.78)

 

 

December 6, 2007

Bell Work:

    Review the homework with a partner, then turn it in.

 

Class Work:

 

    Complete the two classes that Mrs. Thompson will give you.  Type them in BlueJ and make sure they compile.  Save them in your M: Drive to review on Tuesday.

 

    When you have finished the two classes, you may work in Alice.  Create a story or game that uses parameters.  Think of your own story or game idea.  Work in Alice until the end of class and save your parameters project to show me on Tuesday.

 

 

Home Tasks:

 

November 29, 2007

Bell Work:

    Bluej Quiz 

 

Class Work:

 

    Fields, Constructors and Methods

 

Home Tasks:

 

    Know how to write a class's outer wrapping, a field declaration and a constructor

 

 

November 27, 2007

Bell Work:

 

Class Work:

 

    Bluej Chapter 1

 

Home Tasks:

    Answer Review Questions

    Study for Quiz

 

November 13, 2007

Bell Work:

 

Class Work:

 

  • Review Alice Test
  • Discuss BlueJ
  • Begin Final Project
    • Objective:  Create a Frogger Style Game

       

      •    Main Character is controlled by Arrow Keys

      •    Character must cross at least three obstacles to finish

      •    If the character collides with an obstacle, the game ends

      •    If the character finished successfully, the player wins the game

 

Home Tasks:

 

 

November 6, 2007

Bell Work:

 

Class Work:

 

  • Alice Test
  • If Statement Notes

 

Home Tasks:

 

 

November 6, 2007

Bell Work:

 

Class Work:

 

  •  Movie Scene Animations
  • Alice Concepts Review and Notes

 

Home Tasks:

    Review Notes for Alice Test

 

November 1, 2007

Bell Work:

    Finish your Halloween Story and show it to Ms. Evans

 

Class Work:

 

  •  Movie Scene Animations

 

Home Tasks:

 

 

October 30, 2007

Bell Work:

    Open Alice and work on your Farmer in the Dell project

 

Class Work:

  • Penguin project
  • Halloween Story

 

Home Tasks:

    Choose a scene from a favorite movie that is about a minute long.  Document the scene with a storyboard.  Be sure to include exact dialogue (if there is any).  Also be sure to notice the camera angles used for each shot.

 

 

October 25, 2007

Bell Work:

    Open Alice and finish maze project

 

Class Work:

  • Parameters
  • Old McDonald Project

Home Tasks:

 

October 23, 2007

Bell Work:

    Review for the Quiz

 

Class Work:

  • Quiz
  • Finish Soldiers
  • Dragon Flap Wings

Home Tasks:

 

October 18, 2007

 

Bell Work:

    Open Alice  

 

Class Work:

  • Toy Solder Marching Project

Home Tasks:

    Review notes for Software Development Quiz

 

October 6, 2007

 

Bell Work:

    Open Alice, Open your Lunar Lander, Take out your Homework  

 

Class Work:

  • Lunar Lander Project

Home Tasks:

  •  Have a great E-Week

 

October 4, 2007

 

Bell Work:

    Open Alice and add any finishing touches to your story

 

Class Work:

  • Discuss Design Process
  • Begin Lunar Lander Project

Home Tasks:

  •  Problems from the Lunar Lander Packet      #1-5

 

October 2, 2007

 

Bell Work:

    Open Alice and add any finishing touches to your story

 

Class Work:

  • If-Else Statements
  • While Loops
  • Ice-Skater Project
    • The Ice-Skater skates in a cirlce
    • She jumps when space bar is pressed
    • After two jumps the ice-skater says she is too tired to jump any more
   

Home Tasks:

 

 

September 27, 2007

 

Bell Work:

    Open Alice and add any finishing touches to your story

 

Class Work:

  • Grade Alice Stories
  • Complete Penguin Tutorial
  • Interactive Project
    • Create a Scene
    • Make the scene interactive
      • For Example, if the user clicks on the cow, it says Moo.
    • You must have at least 7 objects that are interactive in the scene.
   

Home Tasks:

 

September 25, 2007

 

Bell Work:

 

Class Work:

  • Intro to Alice
  • Set Alice to Java
  • Complete Alice Tutorials 1, 2 and 4
  • Alice Assignment 1:
    • Create a story
    • The Story should have
      • A Beginning
      • A Problem
      • A Solution
      • An End
    • Your story should have at least
      • 10 instructions
      • 5 Objects
      • 2 Methods you create

Home Tasks:

    Finish Alice Story

 

 

September 20, 2007

 

Bell Work:

 

Class Work:

    Continue working on robots

     

 

Home Tasks:

    No Homework

 

September 18, 2007

 

Bell Work:

 

  Type and Run your Even or Odd Program

 

Class Work:

  • Collect Test Corrections
  • Finish Calculators
    • Allow users a choice of what operator to use
  • And now for something different...

     

 

Home Tasks:

 

September 13, 2007

 

Bell Work:

 

  Quiz on Lesson 8

 

Class Work:

  • Review Tests
  • Begin Calculator
  • Discuss Lesson 9
  • Finish Calculators

 

Home Tasks:

 

   Lesson 9: 14-16 and 20

   Project Even or Odd

 

September 11, 2007

 

Bell Work:

 

  Review for Test

 

Class Work:

  • Test
  • Discuss Chapter 8
  • Watch Grace Hopper Interview

 

Home Tasks:

 

   All Chapter 8 problems

   Read Chapter 9

 

 

September 6, 2007

    Test moved to Sept. 11!

 

Bell Work:

 

   Type your Going in Circles Project into Dr. Java

 

Class Work:

 

Home Tasks:

 

   Review for the Test

 

 

September 4, 2007

    Test moved to Sept. 11!

 

Bell Work:

 

   Quiz on Lessons 5 & 6

 

Class Work:

 

Home Tasks:

 

   Review for the Test

   Going in Circles Project

 

 

August 30, 2007

 Reminder: Test on Sept. 6 - Lessons 1-7!

Bell Work:

 

   Quiz on Lesson 4

 

Class Work:

 

  • Finish Test 
  • Discuss Lesson 5
  • Mixed Results Project
  • Discuss Lesson 6

 

Home Tasks:

 

   Read Lesson 7

   Lesson 5: 1-7, 12-14, 17

   Lesson 6: 1-14

 

August 28, 2007

 

Bell Work:

 

    Review for Test

 

Class Work:

 

  • Test 
  • Review Homework
  • Discuss Lesson 5

 

Home Tasks:

 

   Read Lesson 5 & 6

 

August 23, 2007

 

STUDY FOR TEST

 

Bell Work:

 

    Quiz

 

Class Work:

 

  •  Review Homework
  •  Discuss Lesson 4

 

Home Tasks:

 

   Study for Test

   Lesson 4: #1-10

 

August 16, 2007

 

Bell Work:

 

    Quiz

 

August 21, 2007

 

TEST ON CHAPTERS 1-3 MOVED TO NEXT TUESDAY - AUGUST 28

 

Bell Work:

 

    Quiz

 

Class Work:

 

  • Review Quiz
  • FASST Grades
  • Finish Lesson 2
  • Start Lesson 3

 

Home Tasks:

 

   Chapter 2 #1-12

   Read Chapter 3

   Chapter 3 #1-12

   Finish Name that Celebrity

 

August 16, 2007

 

Bell Work:

 

    Quiz

 

Class Work:

 

  • Review Quiz
  • Register on FASST
  • Finish Lesson 1
  • From Me To You Project

 

Home Tasks:

 

   Finish From Me To You

   Read Lesson 2

 

 

 

August 14, 2007

 

Bell Work:

 

    Student Information Form

 

Class Work:

 

  • Introductions and Expectations

 

Home Tasks:

 

   Read Chapter 1

 

Course Information:

 

Syllabus for Programming.doc

Guidelines.doc

First Month.doc

 

Comments (0)

You don't have permission to comment on this page.