Programming Assignments (fall)

Assignment #1 - Create your first web page

1. Using Google Sites, create a basic website about yourself. You may include video clips, songs, pictures, or any other forms of media that you feel best represent who you are.

Your website should include the following:

- Your name and the period that you are in

- A brief write-up about yourself (your name, where you are from, your interests, favourite things, favourite subjects, etc)

- A Homework section where you will be posting links to your completed assignments.

** Also add three other pages in your sidebar.

    • BlueJ (Java)

    • Visual Basic (.Net)

    • Python

These are the two main pieces of software we will be using and we will need sections on our sites for these.

You should use at least 2 columns in your page.

In 1 column you are to make a list of links to other students pages in your class. You will need to spell their name correctly, have the list in alphabetical order, and have the links all working properly. You can find the Class List here, feel free to copy and paste the names into your column. At the end of class, you will need find the students websites from their profiles in the members list and add links to their names.

Google Sites is an easy website to use. There are tutorials and help available within the site.

** Once you have a URL for your site, please update your Google Account under the "my account" section at the top right and add your URL to your profile so when somebody clicks on your Member Name, they will see the link for your site. *** ALSO - Please include your Twitter name in your profile ex. @BillyBob

Example Website: http://sites.google.com/site/aboutmeJosh

Problems logging into Google sites? Try logging out of Google groups then typing http://sites.google.com into your web browser and logging in again.

Assignment #2 - Back to the Future

Due date: Friday, Sept 17th

Due date: End of Class on Tuesday, Sept. 21st

Due date: end of class on Thursday, Sept 23rd

Due date: Thursday, Sept 30, start of class

Due Date: Friday, Oct 6

Due: End of class on Tuesday, November 9th

Due: End of class on Monday, November 22nd

Due: End of class on Tuesday, November 23rd

Due: End of class on Friday, November 26th

Due: Friday, November 26th

Due: Friday, Dec 3rd

Due: Friday, Dec 3rd

Due: Friday, Dec 10th

Computers always have conveyed images of the future, of high technology and of advanced learning. When we look back at computers of the past though, it's amazing how quickly they can appear dated and ancient. It is amazing how quickly technology evolves. If you bought a car 10 years ago would you consider it obsolete today? Of course not but that is certainly not the case in the computer world.

Your assignment will be to take one of our old computer magazines at the front of the class (2004 or older) and find an article that you feel is describing an obsolete technology.

You will need to write a 1 - 2 paragraph description of the article and description of why the technology is obsolete. You should include at least 1 picture found using a Google Image Search to illustrate the technology you are writing about.

You should also research how the technology has evolved or changed and what is today's equivalent. Please include the date of the article in your description.

You need to place the paragraphs and images in the homework section of your website.

Assignment #3 - Frontline: Digital Nation \ Life Online

Watch the Frontline: Digital Nation broadcast - take notes on paper or on the computer.

    • What do you think are the advantages and disadvantages to learner's being so connected nowadays?

    • List 10 pro's and con's and post these into the homework section of your website.

Complete the Life Online activity

Assignment #4 - Life Online: Power Point Presentationn

1st step: Complete the Life Online activity with a partner. Save your notes to a Word document or print them to room A222.

* you will need headphones to listen to the video clips. Please bring some to class on Monday.

2nd step: complete a Power Point presentation with your partner, addressing the points covered below.

You may spend a lot of time communicating with friends through email, text messaging, or social networking sites. So what do you think of life online? What's good about it? What's bad? Is it safe? What are the risks? Where do you draw the line between acceptable and unacceptable behavior?

For your assignment, you will create a Power Point presentation of your ideas about online communication. You may choose a particular topic that interests you or that came up in the videos you watched, or your teacher may have some suggestions for how to focus your presentation.

Your presentation must be:

    • a minimum of 5 minutes in length.

    • must contain pictures and / or videos to illustrate your points.

    • You will be working with a partner - of your choice.

    • You need to create only 1 presentation for both of you.

    • We will be presenting during Thursday and Friday's class next week.

Assignment #5 - Our Social Network

We are going to create a visual wall demonstrating the level that social networking connects us here at Pinetree. To begin this project we will use the photos of ourselves - located in the Teacher Handout folder under Hamlin \ Our Social Network \ Period

You will then import these into Photoshop Elements and cut out your head to create a "floating head" effect. The finished image may be touched up, contrast and brightness increased to create a pure white background, skin tones adjusted, whatever you like.

The finished picture must be on a canvas sized 5 inches by 5 inches (as seen below)

In the handout folder there is a Microsoft Word document called

Our Social Network - Example Page

Please open this and save it into your M:\ account.

You can then edit it and replace my face with yours.

You must then also choose a speech bubble or thought cloud and put your sentence on your thoughts about Social Networking into this.

You can write it in a text box and "float" that above the thought cloud or speech bubble.

Once you have finished - Save your Word document into the Hand-In folder in the Our Social Networking sub-folder.

Assignment #6 - Programming Terms

Create definitions for the following terms and place these in your homework section.

Create a heading that says "Glossary" and place the definitions under that.

  • objects

  • classes

  • methods

  • parameters

  • data types

  • fields

  • constructors

  • accessor methods

  • mutator methods

  • assignment

  • conditional statement

  • local variables

  • instance variables

  • boolean

  • integer

  • string

  • variable

You may work in pairs and you may use any resource you choose such as google searches and/or the textbook chapters (in the handout folder).

Here are some resources to help you begin, use these and other resources to help you complete the assignment.

http://www.cs.columbia.edu/~evs/intro/handouts/prog-glossary.html

http://www.scribd.com/doc/20898720/List-of-Computer-Programming-Glossary-Terms

Assignment #7 - Dog Class

Using the Dog class handout as your template, create your own new project with a distinct Class

all of your own.

You must create at least 4 fields that are unique and that represent your class.

You must create accessor and mutator methods for each field.

Make sure to initialize your fields with a constructor before writing your methods.

Follow along with the Dog class example but change the fields and methods to suite your new Class.

Assignment #8 - Student Class (Lab 1a)

For this lab you will begin to create a class called Student. Here are the

attributes of a student that we are concerned with for the purpose of this project:

  • first name

  • last name

  • student number, e.g. A00012345

  • email address

  • number of courses completed

  • grade, e.g. 78.5

  • is the student in good standing? true or false

Choose appropriate data types and descriptive names for the fields (instance variables), and

declare them. Be sure to specify that they are private.

Write a constructor for this class. The constructor will expect all the information to be passed in

as parameters. Choose descriptive names for the parameters but remember that they cannot bethe same as the field names. Use the parameters to initialize the fields.

Test your project by creating a Student object. Use the BlueJ inspector to check the contents of the fields.

* A suggestion would be to follow the example created in our Dog Class and then modify the variables and methods to suit the student class.

Assignment #9 - Cellphone Class (Lab 1b)

For this lab you will begin to create a class called CellPhone. Here are the attributes of a cell

phone that we are concerned with for the purpose of this project:

  • brand, e.g. Sony Ericson

  • model, e.g. W200a

  • weight in grams

  • megabytes of memory, e.g. 25

  • does it have a touchscreen?

  • does it have a camera?

  • does it have an alarm clock?

  • does it have games?

  • does it vibrate?

Choose descriptive names for the fields (instance variables) and declare them. Be sure to specify that they are private.

Write a constructor for this class. The constructor will expect all the information to be passed in

as parameters. Choose descriptive names for the parameters but remember that they cannot be the same as the field names. Use the parameters to initialize the fields.

______________________________________________________________________________

Java Quiz #1 - Introduction to Object Oriented Programming (introductory concepts)

Note: You MUST remember to write your full name in the "Name" window on your quiz or your score will not count.

Your quiz link will appear here at 8:25am

______________________________________________________________________________

Assignment #10 - Member Class (Lab 3a)

In-class lab

Work with a partner.

A local fitness club needs to model the attributes and behaviors of their

club members. Write a class called Member. Include appropriate comments for each class

element.

Here are the relevant attributes of a Member object. These must be the ONLY fields in your

class. All the attributes must be passed to the object constructor and initialized in the constructor.

  • · first name

  • · last name

  • · height (inches)

  • · weight (pounds)

  • · year of birth

  • · year of joining the club

  • · current year

Here are some of the behaviors of a Member object. Each of these is a method that returns the

specified information when it is invoked.

  • · getFullName returns the member’s full name, e.g. “Joe Smith”

  • · getHeightInches returns the member’s height

  • · getWeightPounds returns the member’s weight

  • · calculateYearsJoined returns the number of years the person has been a member

  • · calculateAge returns the calculated age of the member

  • · calculateAgeAtJoining returns the age the member was when they joined

  • · getsDiscount returns true if the member qualifies for a discount.

People who qualify for a discount are either:

  • - under the age of 12 and members for at least two years

  • - at least 65 years of age

  • - members for at least 10 years

To understand how to return such methods, we need to understand basic math. See Session 3 Power Point for more info on this. This file is also available in the hand-out folder for Chapter 2

** See this page for how to write various Java Operators like "greater than or equal to", etc **

Examples - Using If / Else Statements

Main Example

If / Else Statements - Example 2

If / Else Statements - Example 3

BONUS Asssignment - Book Class (Lab 3b)

Write a Book class. Here are the relevant attributes:

    •  title

    •  author

    •  ISBN (code on back cover)

    •  number of pages

    •  is it a paperback?

    •  suggested retail price

Pass all the necessary information to the constructor. The constructor must check the price

parameter to ensure it is not a negative number. If it is negative, set the price to zero.

Write accessor and mutator methods for all instance variables. The mutator methods for numberof pages and price must ensure that those fields do not become negative.

Write this method:

/** Returns the string “yes” if passed true,

and “no” if passed false /*

public String translate(boolean trueOrFalse)

Write a method called displayBook() that displays the book information on the screen like

this:

Title : Ghost Stories of British Columbia

Author : Jo-Anne Christensen

ISBB : 0-88882-191-3

Pages : 192

Paperback : yes

Suggested price : $17.99

Assignment #11 - BlueJ Final Project

Your client (“Sara's School Supplies”) is a small store that sells a variety of

supplies useful to students. You have been requested to develop an objectoriented

program to help the Sara's School Supplies staff keep track of store

inventory. You begin by creating a prototype for an item to be sold in the store.

    • · Create a new BlueJ project called SchoolSupplies.

    • · Create a class called SchoolItem. Write a summary comment that explains the class.

    • · Define instance variables (fields) to hold the following pieces of data: description, stock code (e.g. 7421 WHI), quantity in stock, quantity sold, purchase price and selling price. Choose descriptive names for your instance variables, and use appropriate data types.

    • · Create a constructor that has parameters for description, stock code, purchase price and selling price. The constructor must check both “price” parameters to be sure they are not below zero. If one of them is negative, set the relevant field to zero. The other numeric fields must be initialized to zero by default. Provide a summary comment for the constructor.

    • · For each field in the class, provide an accessor method that returns the value of the field. These methods must be named to start with “get”, e.g. getQuantityInStock().

    • · Provide a method called restock(). This mutator method takes a parameter that specifies the number of items to add to inventory, and adds that number to the quantity in stock. If the parameter is a negative number it will display an error message and not change the quantity in stock.

    • · Provide a method called sell(). This mutator method subtracts the parameter value from the quantity in stock, but only if the parameter is not negative. Quantity in stock must never be a negative number. If the parameter is negative or too high, an error message will be displayed and the quantity in stock will not change. The sell() method will also change the quantity sold field by the appropriate amount.

    • · Provide a method called setPurchasePrice(). This mutator method accepts the new purchase price as its parameter and changes the appropriate instance variable, but only if the parameter is not below zero.

    • · Provide a method called setSellingPrice(). This mutator method accepts the new selling price as its parameter and changes the appropriate instance variable, but only if the parameter is not below zero.

    • · Add a method called calcProfit() that calculates and returns the profit from selling one item, based on the purchase price and selling price. This method will not display anything on the screen. Comment the calculation.

    • · Add a method called calcTotalProfit() that calculates and returns the profit from all the items that have been sold. This method must invoke calcProfit().

    • · Add a method called calcInventoryValue() that calculates and returns the current value of the quantity in stock, based on purchase price.

    • · Provide a method called printDetails(). This method displays item information on the screen, e.g.

Description: 3-ring binder

Stock code: 1765 BIN

Purchase price: $2.43

Selling price: $5.95

Quantity in stock: 34

Quantity sold: 12

Inventory value: $82.62

Profit on sales: $42.24

    • · Be sure each method has a Javadoc-style descriptive comment above the method header and that the class itself has a descriptive comment that includes your name as author.

Use BlueJ to interactively test your methods as you write them. Write them one

at a time, and test each immediately to be sure it is correct. Testing requires

creating an object and invoking the method. Be sure to test with both valid and

invalid data, i.e. test the “set” methods with positive values to be sure the field is

changed correctly, and test with negative values to be sure the error message is

displayed and the field not changed.

Marks will be given for:

    • · Comments – appropriate and complete.

    • · Style – see the style guide Appendix J of your textbook.

    • · Correctness and completeness – code meets the requirements listed above.

Create a .zip file containing your entire BlueJ project (zip the folder, not the

individual files). Name the .zip file with your name and the assignment number,

e.g. “Susan_Wong_Assign_1.zip” and place it in the hand-in folder by the end of class on Friday, December 10th