Wednesday, June 25, 2008

Superclass and subclass example in class

Write a java program to create a superclass martial arts student. What will a student be able to do after the first class?

Next you will have a subclass Ninja which will extend from the martial arts student. A ninja will be able to do anything the student can do but he can do much more! Add behavior that a ninja could do that a beginning student could not.

Write a main method to show these super and sub classes in action. Try running methods unique to one on the other!

Check out this thread about an IDE debate

See what other programmers have to say. Just read the comments about the different development environments.

I would like you to comment on this blog post. Please give a summary of what the author is saying on your own blog.

Review for third test

This test is loaded with vocabulary and multiple choice questions. Inheritance, interfaces....Read chapter 8,9,10 before class. Some things you may have to read over a few times.

Here's some questions:

http://docs.google.com/Doc?id=dc65q8nz_790qqxdmvfx

Monday, June 23, 2008

Add some points to your previous test

For every programming exercise you do from chapter 6-10 you can get 3 points on your test for a maximum of 9.

Email me and upload it to the FTP server. Deadline next Monday June 30, 2008.

Email me for your grades.

Wednesday, June 18, 2008

A BlackJack program designed by you and a partner

Major Assignment 3
Next major project Due Friday 6/27/08 by the start of class: Design a BlackJack program with another student! Send me a note with who you are working with (or if you choose to work alone).

Use a class Card that randomly assigns the card as either a 2-10 or a Jack, Queen, King, or Ace. Methods should be public int returnValue()will return the int value of a card. You may assume an Ace is an 11 but extra credit (+5) is available if you determine whether it should be a 1 or an 11!

public String returnTypeOfCard() will return the full name of the card.

class BlackJack is where things get interesting...how are you going to represent the game?
What methods are needed to check the sum? What other methods are needed? If the user asks to stop hitting, will the computer dealer want to hit again (Hint, under 17 he will!). Just ignore the suits for now.

It must be done in an object oriented fashion (this is Java, not C). Use arrays of Cards in class BlackJack.

class BlackJackTester() will play the game until the user gives up!

Due Wednesday before 6:00 pm.

Upload it your FTP space.
I'd like both members of the group to upload the .class and .java files to their FTP space.

ftp://davidcfreer.com

Fun little diversion

Check out this cool game written in Java. It can be challenging!

Today's minor assignment

Create a program with a Person class where the user enters in an ArrayList with 5 Persons. A Person is considered to have a name and an age.

Input: 5 Names, 5 ages

Output: The 5 Person objects (names and ages).

Comment each line of your program, explaining what each line is doing!

Upload to FTP space at end of class.

Monday, June 16, 2008

In your own words to define...

Interface, abstract class and inner class.

Pick one; find formula on Internet; do it with Java (static method)

//public static double sphereVolume(double r)

//public static double cylinderSurface(double r, double h)

//public static double coneVolume(double r, double h)

!!!

Wednesday, June 4, 2008

Second major assignment

I hope everyone has read up through chapter 7 in the book. Practice as many exercises as you can from the end of the chapter!

Your second major assignment is as follows:

You are going to design a class for any business of your choosing. You need to keep track of at least four pertinent attributes. You will need at least two other methods in addition to the necessary getters and setters. Create three objects and store them in an array of that type.

You can hard code the business testing info into the main. But if you use Scanner to ask the user what to change, you can get 20 extra points on the assignment!

Here's an example, you need to pick another business:


class LawFirm
{
//typeOfLaw, billableHours, nameOfLawFirm, costPerHour
//+20
//constructors
//+20
//methods: calculateTotalCost, returnMessageAboutFirm
//+30
}

class LawFirmTester
{
//create an array of 3 LawFirm objects
//+20
//display names of law firms and allow user to enter a number to learn more information about each firm
//+10
//allow the user to update the information about the firms- things do change.
//+20
}

}


The number of points are commented above.

Due June 15th, 2008 at midnight! Use netbeans and upload everything in a zip file to your FTP space!

DF

Nursery Program!

Today you are going to create a Plant class with the following information:

Cost

Name

Size

Quantity of plants

The nursery will create an array of plants (let's say they have 5 different types of plants).

The nursery class should keep track of:

Money taken in

Money spent on supplies

Plants on hand

The user should be able to update information about the plants and money that is coming in or out! Let's say the user should be able to update the quantity of certain plants available and the amount of money money taken in to the company!

Here's one way to loop using a trivial example:

Scanner a = new Scanner(System.in);

System.out.println("What would you like to do? [Quit] or [Deposit] $1000");

String ans = a.nextLine();

double deposit = 0;

while(!ans.equals("Quit")) //loop is going the basis

{

if(ans.equals("Deposit"))

{

deposit += 1000.0;

}

System.out.println("What would you like to do? [Quit] or [Deposit] $1000");

ans = a.nextLine();

}

System.out.println(deposit);

Find an interesting article from Slashdot.org

Write a brief summary about the article and post a link to the article on your blog!

Slashdot.org

Monday, June 2, 2008

first assignment of the day

/**
*
* @author dfreer
*/
public class NumberTester {
//Write an if statement to determine if a number is greater than fifty!
//Write the if statement within a public method to be run from a main

//if the number entered is > 50, give the user a message of congrats!!

//main to test it out!

}