Thursday, December 18, 2008
Work due by 6AM tomorrow.
Thanks,
DF
Wednesday, December 10, 2008
Here is your final exam review sheet
Pretty comprehensive. Do lots of practice coding for it!
The exam is next week at 6pm in the room.
Try www.betterprogrammer.com and put your results
Monday, December 8, 2008
Discussed in class 12-8-08
- How do you see yourself using Java in the future?
- What's the future of programming in the next 10 years?
- Visit: http://sourceforge.net/ and download an open source project that seems interesting and utilizes Java. Please read over some of the source code and give me your brief impressions.
- Visit http://www.betterprogrammer.com/ and try it out! How did you do?
- What did you think of Scheme programming? Try it out and put your ideas on the blog.
Wednesday, November 26, 2008
Sixth Major Programming Assignment
· No pair—The lowest hand, containing five separate cards that do not match up to create any of the hands below.
· One pair—Two cards of the same value, for example two queens.
· Two pairs—Two pairs, for example two queens and two 5’s.
· Three of a kind—Three cards of the same value, for example three queens.
· Straight—Five cards with consecutive values, not necessarily of the same suit, such as 4, 5, 6, 7, and 8. The ace can either precede a 2 or follow a king.
· Flush—Five cards, not necessarily in order, of the same suit.
· Full House—Three of a kind and a pair, for example three queens and two 5's
· Four of a Kind—Four cards of the same value, such as four queens.
· Straight Flush—A straight and a flush: Five cards with consecutive values of the same suit.
· Royal Flush—The best possible hand in poker. A 10, jack, queen, king, and ace, all of the same suit.
Implement a payout system! +10
Extra credit if it is a GUI +10.
Due December 5th, 2008.
December 3rd, 2008 is your fourth exam. I will post a review sheet tonight! (as promised :)
Project 7.1 in the book.
11/26/08 In class exercise review
Suppose you have a Town class that describes the demographics of small towns. The vital statistics described by this class are numberOfAdults and numberOfChildren. These vital statistics are encapsulated and not directly accessible from outside the class.
Write an initialize method that establishes initial values of instance variables. Write a simulateBirth method which simulates the birth of one child. Write a printStatistics method that prints out the current vital statistics.
Write a main method that creates a town called newHome. Then call initialize to establish initial values for newHome. Simulate the birth of a pair of twins and print out newHome's statistics.
---
Assignment 2:
Suppose you are asked to model plants using an OOP program. For each of the following plant-related entities, specifiy the most appropriate item to use for its implementation. For each entity, select one of the following: instance variable, object, method, or class.
- plant height
- sequence of activities that occur when a seed germinates
- an indication of whether a plant contains a vascular system
- an individual plant
Please list on your blog 1-4 and whether you believe each would be handled best as a(n) instance variable, object, method, or class.
----
Assignment 3:
Think of a possible "final project" that you could possibly accomplish. Please write an idea or two on your blog!
----
Assignment 4:
See how well you do on this:
Monday, November 24, 2008
In case you are interested...
http://blog.ted.com/2008/03/alan_kay_on_ted.php
Read the article: "What is an algorithm"
The Importance of Algorithms.
from the following great page:
http://www.topcoder.com/tc?module=Static&d1=tutorials&d2=alg_index
I would like for you to answer the following questions on your blog:
- What are algorithms used for?
- What is a random algorithm?
- What is compression?
- What two 'real world' examples does the author give as useful algorithms? Describe them on your blog.
- Do you agree that studying algorithms is a useful tool for programmers and computer scientists?
Saturday, November 22, 2008
Monday, November 17, 2008
Wednesday, November 12, 2008
Great article about recursion
Everyone should read it.
Tower of Hanoi
Code from: http://weblogs.java.net/blog/mortazavi/archive/2005/08/recursive_progr.html
private void moveTower (int numDisks, int start, int end, int temp)
{
if (numDisks == 1)
moveOneDisk (start, end);
else
{
moveTower (numDisks-1, start, temp, end);
moveOneDisk (start, end);
moveTower (numDisks-1, temp, end, start);
}
}
Use Paint to explain the Tower of Hanoi
Also paste this code under the picture:
http://weblogs.java.net/blog/mortazavi/archive/2005/08/recursive_progr.html
Monday, November 10, 2008
Math fun minor project!
Find the sum of all the multiples of 3 or 5 below 1000.
Taken from this website:
http://projecteuler.net/index.php?section=problems&page=1
Coding horror
http://www.codinghorror.com/blog/archives/001184.html
Do you agree with his point? Please reply on your blog.
Make sure to have read through Chapter 12 in the book.
Wednesday, November 5, 2008
How is Blackjack going?
Write one sentence on your blog with something that is not working with your Java Blackjack program.
Don't forget about your major assignments:
http://mdcjava.blogspot.com/2008/10/major-assignments-fall-2008.html
Tuesday, October 28, 2008
Major Assignment 4 Due Friday November 7th, 2008
S)how products I)nsert coin B)uy A)dd product R)emove coins Q)uitYour main class should be called VendingMachineSimulation.
A
Description:
Candy bar
Price:
0.55
Quantity:
10
S)how products I)nsert coin B)uy A)dd product R)emove coins Q)uit
A
Description:
Fruit drink
Price:
0.65
Quantity:
10
S)how products I)nsert coin B)uy A)dd product R)emove coins Q)uit
S
Candy bar @ $0.55
Fruit drink @ $0.65
S)how products I)nsert coin B)uy A)dd product R)emove coins Q)uit
I
A) nickel @ 0.05
B) dime @ 0.1
C) quarter @ 0.25
D) dollar @ 1.0
C
S)how products I)nsert coin B)uy A)dd product R)emove coins Q)uit
I
A) nickel @ 0.05
B) dime @ 0.1
C) quarter @ 0.25
D) dollar @ 1.0
C
S)how products I)nsert coin B)uy A)dd product R)emove coins Q)uit
I
A) nickel @ 0.05
B) dime @ 0.1
C) quarter @ 0.25
D) dollar @ 1.0
A
S)how products I)nsert coin B)uy A)dd product R)emove coins Q)uit
B
A) Candy bar @ $0.55
B) Fruit drink @ $0.65
A
Purchased: Candy bar @ $0.55
S)how products I)nsert coin B)uy A)dd product R)emove coins Q)uit
I
A) nickel @ 0.05
B) dime @ 0.1
C) quarter @ 0.25
D) dollar @ 1.0
D
S)how products I)nsert coin B)uy A)dd product R)emove coins Q)uit
B
A) Candy bar @ $0.55
B) Fruit drink @ $0.65
B
Purchased: Fruit drink @ $0.65
S)how products I)nsert coin B)uy A)dd product R)emove coins Q)uit
R
Removed: $1.55
S)how products I)nsert coin B)uy A)dd product R)emove coins Q)uit
Q
Put it on your FTP space. Due Friday, November 7th, 2008.
Monday, October 27, 2008
Test 3 Review
click here.
Test 1 Average: 79.2777777777778
Test 2 Average: 72.8333333333333
Test 3 Average: ???
Today's review GraderProgram
2. Allow the user to enter three numbers and find the average.
3. Allow the user to enter three numbers, find the average, and give back a letter grade:
90-100 : "A"
80-89 : "B"
70-79 : "C"
60-69 : "D"
0-59 : "F"
4. Allow the user to enter three numbers and find the average if the first is worth 60% and the next two are worth 40% (20% each). Give them back a letter grade according to the previous rule.
5. Allow the user to input numbers until they quit (-1). Weight the grades equally and give back a letter grade!
6. Lastly print out their scores. Here's how:
import java.io.*;
FileOutputStream writeWords2 = new FileOutputStream("output.txt");
PrintStream p1 = new PrintStream(writeWords2);
p1.print("HELLO");
Please put it on your FTP space.
Friday, October 24, 2008
I want to see how well you do with this game...
http://www.addictinggames.com/lightbot.html
What do you think of the game? Please post on your blog.
Wednesday, October 22, 2008
MySQL
CREATE TABLE address_books (first_name VARCHAR(25), last_name VARCHAR(25), phone_number VARCHAR(15), PRIMARY KEY (phone_number));
INSERT INTO address_books (first_name,last_name,phone_number) VALUES ('David','Freer','786-877-4573')";
-------
Next, create a student database using MySQL and a table with some information.Then create a java program (using Netbeans) and show you are able to update it and delete data from the database.Work with another classmate and upload it to your FTP space. However, when you finish call me over and I'll grade it in class.
If you need numbers, you can use INT this.
Major Assignments Fall 2008
http://mdcjava.blogspot.com/2008/09/major-assignment-1-due-september-15.html
The second:
http://mdcjava.blogspot.com/2008/09/second-major-assignmentalso-please.html
The third:
http://mdcjava.blogspot.com/2008/10/third-major-project.html
The fourth:
http://mdcjava.blogspot.com/2008/10/major-assignment-4-due-wednesday.html
The fifth:
A working BlackJack game! Due Friday November 21st, 2008.
The sixth:
http://mdcjava.blogspot.com/2008/11/sixth-major-programming-assignment.html Due Friday December 5th, 2008.
The seventh:
A program of your choosing due by December 17th, 2008. Email me with an outline of your project by December 12th, 2008. Make it something you are interested in but at the same time a project that you can complete!
Monday, October 20, 2008
CoffeeShop and Food classes
Today you will need to make a CoffeeShop class:
//Address
//Manager's name
//An arraylist of food
Food class:
//Price of food
//Description of food
//Quantity
//Make a constructor!
//Create a default constructor!
Within the main:
//The user should be able to make the CoffeeShop...
//The user should be able to enter food into the CoffeeShop (using an arraylist)
//The user to be able to check what's inside the CoffeeShop!
Please upload this minor project to your FTP space ASAP! Also don't forget about your third major project from the book using inheritance!
Wednesday, October 15, 2008
Third Major Project
P10.6 from page 493
Please have it on the FTP space by next Tuesday 10/21 at midnight.
If you have any other work, please put it online and let me know that you uploaded it.
Write a superclass Worker and subclasses HourlyWorker and SalariedWorker. Every worker has a name and a salary rate. Write a method computePay(int hours) that computes the weekly pay for every worker. An hourly worker gets paid the hourly wage for the actual number of hours worked, if hours is at most 40. If the hourly worker worked more than 40 hours, the excess is paid at time and a half. The salaried worker gets paid the hourly wage for 40 hours, no matter what the actual number of hours is. Supply a test program that uses polymorphism to test these classes and methods.
Use the following class as your tester class: /**
This class tests class Worker and its subclasses.
*/
public class WorkerTester
{
public static void main(String[] args)
{
Worker s = new SalariedWorker(''Sally'', 40);
Worker h = new HourlyWorker(''Harry'', 40);
System.out.println(s.computePay(30));
System.out.println(''Expected: 1600'');
System.out.println(h.computePay(30));
System.out.println(''Expected: 1200'');
System.out.println(s.computePay(50));
System.out.println(''Expected: 1600'');
System.out.println(h.computePay(50));
System.out.println(''Expected: 2200'');
}
}
Thursday, October 9, 2008
Minor Project
/**
This class computes the alternating sum
of a set of data values.
*/
public class DataSet
{
/**
Constructs an empty data set.
*/
public DataSet()
{
final int DATA_LENGTH = 100;
data = new double[DATA_LENGTH];
dataSize = 0;
}
/**
Adds a data value to the data set.
@param x a data value
*/
public void add(double x)
{
if (dataSize >= data.length)
{
// make a new array of twice the size
double[] newData = new double[2 * data.length];
// copy over all elements from data to newData
System.arraycopy(data, 0, newData, 0, data.length);
// abandon the old array and store in data
// a reference to the new array
data = newData;
}
data[dataSize] = x;
dataSize++;
}
/**
Gets the alternating sum of the added data.
@return sum the sum of the alternating data or 0 if no data has been added
*/
public double alternatingSum()
{
. . .
}
private double[] data;
private int dataSize;
}
/**
This program calculates an alternating sum.
*/
public class AlternatingSumTester
{
public static void main(String[] args)
{
DataSet data = new DataSet();
data.add(1);
data.add(4);
data.add(9);
data.add(16);
data.add(9);
data.add(7);
data.add(4);
data.add(9);
data.add(11);
double sum = data.alternatingSum();
System.out.println("Alternating Sum = " + sum);
System.out.println("Expected: -2");
}
}
Monday, October 6, 2008
Static method practice in class
- Make a static method that takes in two numbers and multiples them and returns the result. Call it multiplier(int x, int y)!
- Make a static method that takes in two integers and returns the lower of the two
call it findMinimum()
print out the results! - Make a static method, call it dividerOfTwoNumbers(int x, int y){ }
Ask the user for two numbers. Divide the first number by the second number IF the second number is not zero.
If they enter a zero, tell them: "You fool! You can't divide by zero!"
Wednesday, October 1, 2008
Pseudocode to do Blackjack
What classes? Within those classes, what attributes and methods would you need?
What's the input? What's the output?
Let's start by writing the pseudocode on your blog...
Monday, September 29, 2008
Wednesday, September 24, 2008
For fun and for your blog
Now he works for Google. He's not too fond of some of his experiences at Microsoft...
_____________________________________________________
Paul Graham is a great thinker when it comes to starting new businesses. Read this article and explain why you think there aren't "more Googles."
Put your answer on your blog. You may be brief. It will count for towards your blog grade.
Second Major Assignment...also please upload your First Assignment
Your second major assignment is as follows:You are going to design a class for a business of your choosing. You need to keep track of at least four attributes.
You will need at least two other methods in addition to the necessary getters and setters.
After you create your class, make 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 will 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 Wednesday October 1st on your FTP space.
LoveTester
Determine if they are a good match and output it to the GUI!It doesn't have to be serious.Minor project grade.
Work with someone from class if you wish.
Wednesday, September 17, 2008
Test 1 Information
This developer uses these 15 exercises to master a language.
Try as many questions as you can from the Big Java book. Also read the first five chapters.
Here's a review for the first test next week.
Test 1 will be on September 23th.
Project 1 will be due on the same day. Bring in your program 1 code on a flash drive on Monday.
Coding done in class September 17th, 2008
{
public static void main(String [] args)
{ //main method needed to run java application
System.out.println("Hello World!");
//syntax to print "Hello World!"
//while loop
//for loop
int counter = 0;
while(counter <= 10)
{
System.out.println(counter);
counter += 2; //the shortcut for counter = counter + 2;
}
for(int i = 100; i > 0; i --)
{
System.out.println(i);
if(i % 25 == 0){
System.out.println(i + " THIS IS A SPECIAL NUMBER!");
}
}
for(int i = 200; i > 0; i --)
{
//System.out.println(i);
if(i % 3 == 0 || i % 7 ==0 ){
System.out.println(i + " THIS IS A SPECIAL NUMBER 3 and 7");
}
}
} //Closing curly brackets /* hello */
} //closing curly brackets
1. Write a program to display "Hello World"
2. Write a program that loops to ten from 0 by 2 and prints out the result!
3. Add a for loop that counts down from 100 to 0 by one! Print out the results!
4. Within the previous loop, if a number is divisible by 25 evenly
output THIS IS A SPECIAL NUMBER!! %
5. Count down from 200 by 1 and find out if a number is divisible evenly by 3 and 7 together.
If it is print out a message "This number is divisible by 3 and 7!"
6. Start Netbeans and make a class for a student. Keep track of the GPA and Name. Provide getters,
setters, and a constructor! Call this class student.
7. Test program with main method by passing in a student
named "Jose" with a GPA of 3.5.
8. Make an array of 4 students and give them whatever info you like.
9. Print out the information in the array!
10. Ask user to enter a student name and GPA and make a student object!
Monday, September 15, 2008
If you have access...
The assignment will be due on the day of the first exam, next Monday. :)
Allow the user to update a vending machine
This will use looping, variables, user input and output, and arrays possibly.
Wednesday, September 10, 2008
Saturday...come meet the professors and CIS people
September 20, 2008
Room K413
9:00 AM
Monday, September 8, 2008
Major Assignment 1 Due September 15, 2008
Program A:
Provide a class for authoring a simple letter. In the constructor, supply the names of the sender and the recipient:
public Letter(String from, String to)
Supply a method
public void addLine(String line)
to add a line of text to the body of the letter.
Supply a method
public String getText()
that returns the entire text of the letter. The text has the form:
Dear recipient name :
blank line
first line of the body
second line of the body
. . .
last line of the body
blank line
Sincerely,
blank line
sender name
Also supply a program LetterPrinter that prints this letter.
Dear John:
I am sorry we must part.
I wish you all the best.
Sincerely,
Mary
Construct an object of the Letter class and call addLine twice.
Hints: (1) Use the concat method to form a longer string from two shorter strings. (2) The special string “\n” represents a new line. For example, the statement
body = body.concat(''Sincerely,'').concat(''\n'');
You may also use the plus sign + to add two Strings together.
adds a line containing the string “Sincerely” to the body.
Complete the following class in your solution:
/**
This class models a simple letter.
*/
public class Letter
{
/**
Constructs a letter with a given sender and recipient.
@param from the sender
@param to the recipient
*/
public Letter(String from, String to)
{
. . .
}
/**
Adds a line to the body of this letter.
*/
public void addLine(String line)
{
. . .
}
/**
Gets the text of this letter.
*/
public String getText()
{
. . .
}
private String sender;
private String recipient;
private String body;
}
Program B:
You are to create a BankAccount class with the following capabilities. The bank will be charging a fee for every deposit and withdrawal. Supply a mechanism for setting the fee and modify the deposit and withdraw methods so that the fee is levied. Test your resulting class and check that the fee is computed correctly.
The bank will allow a fixed number of free transactions (7 deposits or withdrawals) every month, and charge for transactions exceeding the free allotment. The charge is not levied immediately but at the end of the month.
Supply a new method deductMonthlyCharge to the BankAccount class that deducts the monthly charge and resets the transaction count.
Produce a test program that verifies that the fees are calculated correctly over several months.
Five bonus points if you enable user input for each program. The input will be used to create the objects.
Five more bonus points if Program B continues to loop until user chooses to Quit.
Zip up both files as Netbeans projects.
Find an article about something that interests you...
September 8, 2008
You may work with a classmate or two or by yourself.
When you are finished you may add the random number ability:
int ranNumber = (int)(Math.random()*100);
if(ranNumber > 50)
{
System.out.println(ranNumber + " is greater than 50");
}
else if(ranNumber > 25)
{
System.out.println(ranNumber + " is greater than 25");
}
else
{
System.out.println("Your number sucks!");
}
Wednesday, September 3, 2008
First Post: What are your expectations for the class?
Client.java
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package bankaccount;
/**
*
* @author dfreer
*/
public class Client {
//Client properties
private String firstName;
private String lastName;
private double balance;
private int socialSecurity;
//methods for the Client
public String returnName()
{
return firstName + lastName;
}
public double getBalance(){
if(balance > 0)
return balance;
else
return -9999;
}
public void deposit(double amt)
{
balance = balance + amt;
}
//this is the constructor for the client object
public Client(String fn, String ln, double b, int ss){
firstName = fn;
lastName = ln;
balance = b;
socialSecurity = ss;
}
public static void main (String [] args)
{
Client ourFirstClient = new Client("Dwyane", "Wade", 6787456.24, 123456798);
//we make an object of Client for Dwyane Wade and return his balance
System.out.println(ourFirstClient.getBalance());
//6787456.24 is expected
ourFirstClient.deposit(1000000);
System.out.println(ourFirstClient.getBalance());
//boolean a = true;
//add to the constructor an address, preferred customer capability,
//add a method to withdraw money but do not let customer withdraw more than they
//have
}
}
Wednesday, August 27, 2008
First minor assignment
public class LunchCart
{
//properties of a LunchCart
private int num_Sandwiches;
private int num_Drinks;
private double price_of_sandwich;
private double price_of_Drinks;
private double total_value_of_sandwiches;
private double total_value_of_Drinks;
//setter methods for the LunchCart
public void setNumSandwiches(int x)
{
num_Sandwiches = x;
}
//getter methods for the LunchCart
public int getNumSandwiches()
{
return num_Sandwiches;
}
//setter method!
public void setNumDrinks(int y)
{
num_Drinks = y;
}
//getter method!
public int getNumDrinks()
{
return num_Drinks;
}
public static void main(String [] args)
{
LunchCart thisismylunchcart = new LunchCart();
thisismylunchcart.setNumSandwiches(55);
System.out.println(thisismylunchcart.getNumSandwiches());
thisismylunchcart.setNumDrinks(15);
System.out.println(thisismylunchcart.getNumDrinks());
}
}
Add the ability to set the other variables and calculate the value of the sandwiches and the value of the drinks.
Finish this assignment by next class. To do this, you'll most likely need to install Netbeans.
Here is how to install Java to use the command line.
Print out the code before next class. Even if you don't get all the getter and setter methods or calculations, print out what you have. This will be the last and only code that you have to print out. Usually you'll put it on an FTP server.
Monday, July 28, 2008
Minimum Fun!
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package minimumfun;
/**
*
* @author dfreer
*/
public class Main {
public static int calcMinimum(int [] a, int counter, int minimum)
{
if(counter == a.length-1)
return minimum;
else
{
if(a[counter] > minimum)
{
return calcMinimum(a, ++counter, a[counter]);
}
return calcMinimum(a, ++counter, minimum);
}
}
public static int minimum(int [] a)
{
int minimum = a[0];
return calcMinimum(a, 0, minimum);
}
public static void main(String [] args)
{
int [] b = {3,4,5,6,2,5};
System.out.println(minimum(b));
}
}
Pseudocode
/**
*
* @author dfreer
*/
public class SmallestNumber {
//How are we going to use recursion to figure out the smallest number???
//take in an array of integers
public static int findSmallest(int [] a)
{
//call another method with a counter
return findSmallestRecursively(a, 0);
//return smallest number (int)
}
public static int findSmallestRecursively(int [] a, int counter)
{
//base case
//if we've reached the end of the array, stop! return minimum!
//if statement to determine whether next number is smaller or larger
//keep track of the smallest number using a variable (int)
//call findSmallestRecursively from itself!! (this is what makes recursion)
//within the recursive call increment counter!
}
public static void main(String []args)
{
//call the first method!
}
Final Exam Review
It will be 50% conceptual and 50% coding. The coding will be similar to the exam 4's.
8 people have A's after last test.
Here's the grades.
On your blog
What is the difference between a stack and a queue?
Pick two sorting algorithms and explain how they work.
Final Major Project
Please post this on your blog.
Monday, July 21, 2008
Final project
For the final project, be creative and think of an application or game that interests you. It can be done with Netbeans as a GUI or as a console based program.
I'm not asking for anything in particular but it should be along the lines that we've done in class. A program that outputs "Hello World!" won't cut it.
So it could be related to business or gaming or personal interests. 30% of the grade will be for creativity, 50% if it runs, and 20% if it does what it says it does!
Email me if you need some ideas. You can work with someone else in the class as well.
Second blog for today: Using recursion....
Tower of Hanoi Code!!!
{
public static void main (String args[])
{
int numdisks = 3;
H_dohanoi(numdisks, 3, 1, 2);
System.exit(0);
}
static void H_dohanoi(int n, int t, int f, int u)
{
if (n > 0) {
H_dohanoi(n-1, u, f, t);
H_moveit(f, t);
H_dohanoi(n-1, t, u, f);
}
}
static void H_moveit(int from, int to)
{
System.out.print("move ");
System.out.print(from);
System.out.print(" --> ");
System.out.println(to);
}
}
Try running it with 6 pegs!
First blog post: Use paint to describe the steps in solving the Tower of Hanoi
Recursion
Tonight we will be learning recursion. The test will be postponed until Wednesday.
Wednesday, July 16, 2008
Test Four Review
Monday, July 14, 2008
Where can you find code to read? Sourceforge.net!
Here's a direct link to the download.
I'd recommend downloading source code from different projects and reading through them. As you get to be a better programmer you can join projects. This looks very good on a resume!
http://sourceforge.net/
Blog reaction:
I'd like you to pick another project using Java (search for Java), download it, and check out the source code. Put your reactions to the site (http://sourceforge.net/) and the code you downloaded on your blog.
Perfect Numbers and Prime Numbers! (Minor Project)
For example: 6 is a perfect number because 6 = 1 + 2 + 3 (1, 2, 3 are divisors of 6)
28 is also a perfect number: 28 = 1 + 2 + 4 + 7 + 14
Make your method static and test it!
You need th % modulus operator to make this work.
The second part is to find all the prime numbers up to a certain number. For instance if a user enters in 5, you will find all the prime numbers up to 5. Would 5be included? Yes! It is prime. 1 is not prime. Create a new static method to determine all the prime numbers up to that point.
Here are some notes on the questions. Pseduocode to turn into code.
Due Friday July 18th, 2008.
BetterProgrammer.com
Using Netbeans try this four problems. Save your work in Netbeans and comment your thought process. Even if you don't know how to do something, try your best to use the Internet to figure out the answer!
Friday, July 11, 2008
Wednesday, July 9, 2008
In class individual exercise
Input:
- Enter your objective test scores, -1 to stop.
- Enter your project scores, -1 to stop.
- Enter your performance scores, -1 to stop.
Output:
Letter grade (A-F)
Rules:
- First average the performance tests, objective tests, and project scores.
- Objective tests are worth 20% of the final grade.
- Performance tests are worth 60% of the final grade.
- Project grades are worth 20% of the final grade.
- A = 100-90
- B = 80-89
- C=70-79
- D=60-69
- F=0-59
- There are at most five objective tests, five projects, and four performance exams.
Blog post
Be methodical with the steps.
Monday, July 7, 2008
Major Assignment 4... Due July 14, 2008
Using the business you worked with in the second assignment, you are going to create a GUI using Netbeans.
The user must be able to keep track of certain information about the business. After the user enters the information and clicks on the "Create Button" an object of that type must be created. For example, if you did a pre-school business by clicking on "Create Classroom" you would have made a classroom with a teacher, a certain number of students, a time, etc.
Save the object in an ArrayList. For instance with the previous example, we will end up with an ArrayList of Pre-school classrooms.
While working on love-tester...
If you did the extra questions from the book, let me know. This will be for feedback as well.
DF
Wednesday, July 2, 2008
Minor Assignment
Using a Java GUI evaluate three pieces of information from Person A and three pieces of information from Person B.
Determine if they are a good match and output it to the GUI!
It doesn't have to be serious.
Minor project grade. Work with someone from class if you wish.
Minor Project: Student database
Then create a java program (using Netbeans) and show you are able to update it and delete data from the database.
Work with another classmate and upload it to your FTP space. However, when you finish call me over and I'll grade it in class.
To alter the table.
MySQL - GUI Example
http://dev.mysql.com/downloads/mysql/5.0.html#win32
Creating tables
http://mdcjava.blogspot.com/2008/04/creating-tables-within-mysql.html
Wednesday, June 25, 2008
Superclass and subclass example in 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
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
Here's some questions:
http://docs.google.com/Doc?id=dc65q8nz_790qqxdmvfx
Monday, June 23, 2008
Add some points to your previous test
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
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
Today's minor assignment
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
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)
!!!
Monday, June 9, 2008
Saturday, June 7, 2008
Wednesday, June 4, 2008
Second major assignment
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);
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!
}
Sunday, May 25, 2008
FTP access
The FTP service is ftp://davidcfreer.com
Username is your first name:
(Davids need to put David plus the first letter of your last name. Example: David Smith is DavidS)
Password is your MDC student ID.
If you have no idea how to use FTP, I will teach you on Wednesday before our test.
Wednesday, May 21, 2008
Major Assignment 1: Due Friday May 30th, 2008
Provide a class for authoring a simple letter. In the constructor, supply the names of the sender and the recipient:
public Letter(String from, String to)
Supply a method
public void addLine(String line)
to add a line of text to the body of the letter.
Supply a method
public String getText()
that returns the entire text of the letter. The text has the form:
Dear recipient name :
blank line
first line of the body
second line of the body
. . .
last line of the body
blank line
Sincerely,
blank line
sender name
Also supply a program LetterPrinter that prints this letter.
Dear John:
I am sorry we must part.
I wish you all the best.
Sincerely,
Mary
Construct an object of the Letter class and call addLine twice.
Hints: (1) Use the concat method to form a longer string from two shorter strings. (2) The special string “\n” represents a new line. For example, the statement
body = body.concat(''Sincerely,'').concat(''\n'');
You may also use the plus sign + to add two Strings together.
adds a line containing the string “Sincerely” to the body.
Complete the following class in your solution:
/**
This class models a simple letter.
*/
public class Letter
{
/**
Constructs a letter with a given sender and recipient.
@param from the sender
@param to the recipient
*/
public Letter(String from, String to)
{
. . .
}
/**
Adds a line to the body of this letter.
*/
public void addLine(String line)
{
. . .
}
/**
Gets the text of this letter.
*/
public String getText()
{
. . .
}
private String sender;
private String recipient;
private String body;
}
Program B:
You are to create a BankAccount class with the following capabilities. The bank will be charging a fee for every deposit and withdrawal. Supply a mechanism for setting the fee and modify the deposit and withdraw methods so that the fee is levied. Test your resulting class and check that the fee is computed correctly.
The bank will allow a fixed number of free transactions (7 deposits or withdrawals) every month, and charge for transactions exceeding the free allotment. The charge is not levied immediately but at the end of the month.
Supply a new method deductMonthlyCharge to the BankAccount class that deducts the monthly charge and resets the transaction count.
Produce a test program that verifies that the fees are calculated correctly over several months.
Five bonus points if you enable user input for each program. The input will be used to create the objects.
Five more bonus points if Program B continues to loop until user chooses to Quit.
---
Turn in your source code by Tuesday, either by (A.) zipping it up and sending it to me via email (B.) zipping it up, bringing it in via flash drive and sending it to me via the MDC network (C.) http://www.megafileupload.com/ or similar and a link.
Don't forget to comment throughout your program. Refer to inputs and outputs.
If you need help, send me any questions.
DF
Email me your programs before midnight Friday May 30th, 2008 or bring it in on a flash drive on May 28th 2008.
Find an article that interests you and write a few ideas about it
Put on your blog or Google Documents!
In class program
Do this with another classmate if you wish.
Nursery Project
Now I would like for you to work on a Plant class.
What attributes will you need to keep track of with this class? How will it be used by the Nursery class?
BlueJ is a good IDE for a project like this.
Link to study for the test.
Here's your review sheet.
You'll notice that I put a link to this review sheet under the "Links" section of the blog. It will be there all semester! Before every test I will give you a comprehensive review for the test.
Monday, May 19, 2008
Download this and save it on your flash drive
Install Netbeans 6.1 at home.
Download BlueJ here.
Install it at home.
This is how to install Java to run it from the command line!
Wednesday, May 14, 2008
First Homework
Exercise R2.1.
Explain the difference between an object and an object reference.
Exercise R2.2.
Explain the difference between an object and an object variable.
Exercise R2.3.
Explain the difference between an object and a class.
Exercise R2.4.
Give the Java code for constructing an object of class Rectangle, and for declaring an object variable of class Rectangle.
Exercise R2.5.
Explain the difference between the = symbol in Java and in mathematics.
Exercise R2.6.
Uninitialized variables can be a serious problem. Should you always initialize every int or double variable with zero? Explain the advantages and disadvantages of such a strategy.
Exercise R2.7.
Give Java code to construct the following objects:
(a)
A rectangle with center (100, 100) and all side lengths equal to 50
(b)
A string “Hello, Dave!”
Create objects, not object variables.
Reaction to this quote
Think about all the attributes and methods a plant nursery would need
Most important attributes and methods a plant nursery would have.
Class PlantNursery
Attributes: (String, int, or double)
cost : double
Methods:
Monday, May 12, 2008
Two assignments
david.freer@gmail.com
- with the information whether or not you have the book
- what is the URL to your blog.
Use the email account that you use the most.
Welcome to Java and Object Oriented Programming
First blog post: What do you hope to get out of COP2800 Introduction to Java?
Your first assignment is to read this article about classes and objects.
Thursday, May 1, 2008
Tuesday, April 29, 2008
Java Final Exam!
- Recursion
- ArrayList
- Strings
- double vs. int
- Writing methods.
The coding part will be the math game. You can do it ahead of time and put it on your FTP space. It's more accurate than hand-coding it on paper.
It won't take too long! I would like to spend time in class discussing queues, stacks, and other data structures...
Deadline for final project: Friday.
Write a blog post about the status of your final project!
See how well you do on this test.
Check out these 10 questions from Sun.
How did you do?
What is going on here?
Also please read the single most important thing you must do to improve your programming career.
Using three IDEs (and Notepad) to create Java programs.
Download this. Open it with BlueJ.
Create a class to keep track of zoo animals. Use Netbeans to enter in their information. Store the info in an ArrayList when a button is clicked.
Lastly using Eclipse, write a program that teaches arithmetic to your younger brother. The program tests addition and subtraction. In level 1 it tests only addition of numbers less than 10 whose sum is less than 10. In level 2 it tests addition of arbitrary one-digit numbers. In level 3 it tests subtraction of one-digit numbers with a non-negative difference. Generate random problems and get the player input. The player gets up to two tries per problem. Advance from one level to the next when the player has achieved a score of five points.
Use the following class as your main class:
/**
This program runs the math game.
*/
public class MathGameRunner
{
public static void main(String[] args)
{
MathGame game = new MathGame();
game.play();
}
}
Thursday, April 24, 2008
Recursive
More recursive fun:
Write and test a recursive method/function that returns the SUM of the squares of the first n positive integers.
Put your code on your blog when you are finished!
GCD
public static int gcd(int m, int n)
{
if(m==n) return n;
else if(m < n) return gcd(m,n-m);
else return gcd(m-n,n);
}
//WHY DOES THIS WORK???
Think about them before you give up.
More brain teasers:
- Consider a two-player game played on a circular table of unspecified diameter. Each player has an infinite supply of quarters, and take turns placing a quarter on the table such that it is completely on the table and does not overlap with any other quarters already played. A player wins if he makes the last legal move. Which player (if any) has a strategy that will guarantee a win, and what is that strategy?
- How do you divide a cake among n people, maximizing fairness?
What do you think?
Blog post about Microsoft
When you are done checking out the article, I'd like you to attempt this test online:
http://www.betterprogrammer.com/
Better "Tower of Hanoi"
public static void main(String [] args)
{
runHanoi(3,'A', 'B', 'C');
}
public static void runHanoi(int n, char x, char y, char z)
{
if(n==1)
System.out.println("Move top disk from peg " + x
+ " to peg " + z);
else
{
runHanoi(n-1,x,z,y);
runHanoi(1,x,y,z);
runHanoi(n-1,y,x,z);
}
}
}
Very strict OO approach
http://binstock.blogspot.com/2008/04/perfecting-oos-small-classes-and-short.html
- Lots of methods!
- Longer variable names!
- No else?
Comment on your blog: what do you think about this approach?
GUI Programming
//New Frame
//New Label
//add
//setVisible(true)
//setSize
Here's some source code:
Calculator example.
Remember what we did with connecting Java to the database?
Look at this.
Wednesday, April 23, 2008
Tuesday, April 22, 2008
sum all the values of an array
Computes the sum of a set of data values.
*/
public class DataSet
{
/**
Constructs a DataSet object.
@param values the data values
@param first the first value in the data set
@param last the last value in the data set
*/
public DataSet(int[] values, int first, int last)
{
this.values = values;
this.first = first;
this.last = last;
}
/**
Gets the sum in the set of data values
@return the sum value in the set
*/
public int getSum()
{
if (first > last)
return 0;
DataSet tail = new DataSet(values, first + 1, last);
int tailSum = tail.getSum();
return values[first] + tailSum;
}
private int[] values;
private int first;
private int last;
}
Your final project
I'd like for you to think about something you are interested in! If you are into cars maybe you could think of a Java application that helps a dealer. If you like games, perhaps you can come up with an interesting game! Please write your idea on your blog today.
Final due:
MAY 3rd 2008 at 8am!!!!
Question and solution
public class DataSet
{
public DataSet(int[] values, int first, int last) { . . . }
public int getMaximum() { . . . }
. . .
}
Hint: Find the largest element in the subset containing all but the last element. Then compare that maximum to the value of the last element.
Used the following class as your tester class:
import java.util.Random;
/**
A tester class for the recursive maximum.
*/
public class DataSetTester
{
public static void main(String[] args)
{
int[] values = { 1, 10, 100, -1, -10, -100, 100, 0 };
DataSet d = new DataSet(values, 0, values.length - 1);
System.out.println("Maximum: " + d.getMaximum());
System.out.println("Expected: 100");
}
}
//SOLUTION:
/**
Computes the maximum of a set of data values.
*/
public class DataSet
{
/**
Constructs a DataSet object.
@param values the data values
@param first the first value in the data set
@param last the last value in the data set
*/
public DataSet(int[] values, int first, int last)
{
this.values = values;
this.first = first;
this.last = last;
}
/**
Gets the maximum in the set of data values
@return the maximum value in the set
*/
public int getMaximum()
{
if (first > last)
return Integer.MIN_VALUE;
DataSet tail = new DataSet(values, first + 1, last);
int tailMax = tail.getMaximum();
return Math.max(values[first], tailMax);
}
private int[] values;
private int first;
private int last;
Monday, April 21, 2008
Random?
http://www.alife.co.uk/nonrandom/
It doesn't appear that random.
Also, this can't be true, can it?
Thursday, April 17, 2008
Check this out!
http://books.google.com/books?q=The+Algorithm+Design+Manual+
Click on the first link. I doubt Google will update THEIR algorithm until you click on the link. ;)
Isn't books.google.com cool?
---
Also I would like for you to check out this tutorial about game design with Java.
After the test...
This is what I'm talkin' bout!!!
Show me it works when you are finished.
Read this article and respond to it on your blog.
Read this article and let me know what you think. Good idea?
Funny explanation for inner classes!
http://www.javaranch.com/campfire/StoryInner.jsp
Tuesday, April 15, 2008
Next Project 6
For the next major project you will have two choices...you can either create a console based Monopoly game (or graphical Monopoly game for major extra credit) or you can edit the code and create an interesting game out of the source code above.
Other creative game ideas are possible as well. Let me know.
DUE next Tuesday.
Monopoly Pseudocode
Thinking in an object oriented fashion!
What classes would they need?
What methods would they need?
What instance variables?
http://en.wikipedia.org/wiki/Monopoly_(game)
Monday, April 14, 2008
A little project I'm working on now...
public class Monopoly {
private Property [] gameboard = new Property[40];
//create new game board
public Monopoly()
{
gameboard[0] = new Property("Go");
gameboard[1] = new Property("Mediterranean");
gameboard[2] = new Property("Community Chest");
gameboard[3] = new Property("Baltic");
gameboard[4] = new Property("Income Tax");
gameboard[5] = new Property("Reading Railroad");
gameboard[6] = new Property("Oriental");
gameboard[7] = new Property("Chance");
gameboard[8] = new Property("Vermont");
gameboard[9] = new Property("Connecticut");
gameboard[10] = new Property("Jail");//all okay
gameboard[11] = new Property("St. Charles");
gameboard[12] = new Property("Electric");
gameboard[13] = new Property("States");
gameboard[14] = new Property("Virginia");
gameboard[15] = new Property("Pennslyvania Railroad");
gameboard[16] = new Property("St. James");
gameboard[17] = new Property("Community Chest");
gameboard[18] = new Property("Tennessee");
gameboard[19] = new Property("New York");
gameboard[20] = new Property("Free Parking");
gameboard[21] = new Property("Kentucky");
gameboard[22] = new Property("Chance");
gameboard[23] = new Property("Indiana");
gameboard[24] = new Property("Illinois");
gameboard[25] = new Property("B&O Railroad");
gameboard[26] = new Property("Atlantic");
gameboard[27] = new Property("Ventnor");
gameboard[28] = new Property("Waterworks");
gameboard[29] = new Property("Marvin Gardens");
gameboard[30] = new Property("Go to jail");
gameboard[31] = new Property("Pacific");
gameboard[32] = new Property("North Carolina");
gameboard[33] = new Property("Community Chest");
gameboard[34] = new Property("Pennslyvania");
gameboard[35] = new Property("Short Line Railroad");
gameboard[36] = new Property("Chance");
gameboard[37] = new Property("Park Place");
gameboard[38] = new Property("Luxury Tax");
gameboard[39] = new Property("Boardwalk");
//all full!
}
public int[] returnOwner()
{
int []i = new int[40];
}
Friday, April 11, 2008
Fifth Major Assignment
Answer Exercises P10.3, P10.5, P10.6 by Monday at 11:59am. (Deadlines are good for focusing your attention.)
Please put each question in a separate folder on your FTP space.
Thursday, April 10, 2008
Tuesday, April 8, 2008
ArrayList, LinkedList...intro to Data Structures
Read about dynamic arrays.
Here is the example for the LinkedList.
Read about linked lists.
Major Assignment Three and Four
As promised, here's your next major assignment which will be due before midnight on Sunday April 5th 2008. I'm in the process of going over the Blackjack programs tonight.
For this third assignment, I'm giving you a completed class and two partially completed classes for a mail server system.
Use BlueJ for this assignment. Create a new project called mail-system and within it three classes: MailClient, MailServer, MailItem.
Use the code I gave you but fill in the missing behaviors based on the names of the methods. It's quite a bit simpler than the Blackjack program.
Here's the code for the classes.
On blog for Record Keeping
Emailed April 2nd.
Major Assignment 4:
Create a Tic Tac Toe GUI by Sunday at midnight.
+20 points for an Applet online at davidcfreer.com
What are you interested in doing for a final project?
For fun, try this out!
Check out the source code...pretty cool.
Also about video games, did you know what a "kill screen" is? Funny.
Thursday, April 3, 2008
Tuesday, April 1, 2008
Predicting the future...
Create new database, table, and front-end app with Netbeans
Creating tables within MySQL
INSERT INTO address_books (first_name,last_name,phone_number) VALUES ('David','Freer','786-877-4573')";
Sunday, March 30, 2008
Thursday, March 27, 2008
LoveTester!
In class we did the following examples:
- Print out to the console from info entered in a text field.
- Ask a user for a number and give the user that number doubled.
- Ask a user for a number and multiply it by a second number entered by the user.
To accomplish the second and third task we needed to first save the data (accessed on the text field with the .getText() method) and then parse the data (think casting!) as an integer.
Here's the code we used in class:
public void doubleNumber() {
numToMultiply = jTextField1.getText();
numToMultiplyBy = jTextField2.getText();
//Getting the info from the text field
numberToMultiply = Integer.parseInt(numToMultiply);
numberToMultiplyBy = Integer.parseInt(numToMultiplyBy);
finalNumber = numberToMultiplyBy * numberToMultiply;
//Double the number
// numToDouble = Integer.toString(numberToDouble);
//Convert the doubled number to a String
newNum.setText(Integer.toString(finalNumber));
// Set the label "newNum" with the doubled number!
}
private String numToMultiply, numToMultiplyBy;
private int numberToMultiply, numberToMultiplyBy, finalNumber;
The in-class assignment was to create a LoveTester that asks the user for 3-5 pieces of information about himself and 3-5 pieces of information about his lover. The complicated LoveTester Algorithm (patent pending) is going to reveal the level of attraction, lust, and love for the two people!
Tuesday, March 25, 2008
After the test, we are going to start designing with NetBeans
Sunday, March 23, 2008
Blog assignment #5: How do you comment when you write programs?
First, read this. On your blog, answer the following question: how do you comment when you are programming? Do you add attributes and methods to a class and then add comments at the end? Do you write comments as you code? Lastly, what did you think of the article. Title this blog post- Blog assignment #5.
Blog assignment #4:
The following blogs are very useful to aspiring computer scientists:
- http://www.codinghorror.com/blog/
- http://googlepublicpolicy.blogspot.com/
- http://googleblog.blogspot.com/
- http://scottaaronson.com/blog/
- http://www.techmeme.com/
- http://www.javablogs.com/Welcome.action
You may want to add them to your Google Reader account.
Blog assignments #1-3:
If you haven't done the first three blog posts, here are the links:
Thursday, March 20, 2008
Wednesday, March 19, 2008
Tuesday, March 18, 2008
Lunch Cart Example
* Class LunchCart-
*
* Attributes:
* totalProfit
* numSandwiches
* numSodas
* totalTaxes
*
*
* Methods:
*
*
* Class Employees(String employee_num, String emp_name, int hours_wked)
* Class Employees(String employee_num, String emp_name)
* {
*
* }
* Attributes:
* hoursWorked
* employeeNumber
* salary
*
*
* Methods:
* getTotalHoursWorked()
* setTotalHoursWorked()
* getEmployeeNumber()
*
*/
public class LunchCart {
//Input, output using Scanner
//Process data using relevant conditionals and/or looping.
//What's most important for the LunchCart!!
}
Add the guessing game to Google Documents
Here's your guessing game Guessing.java assignment
// you give tips based on how close or far they are. If they are 20+ digits away you can lol
//or if they are within 10-20, say they are within a decent range, otherwise say they are getting
//closer!
Monday, March 17, 2008
Thursday, March 13, 2008
Post URL for Tic Tac Toe code!
In the links add the URL to the Tic Tac Toe source code that you found. Title it "Tic Tac Toe Source Code".
First In-"Class" Assignment
Assignment 1
Wednesday, March 12, 2008
Organizing the web's information...
Tuesday, March 11, 2008
Car.java
* Car.java
*
* Created on March 11, 2008, 8:20 PM
*
* To keep accurate account of our cars.
*/
/**
*
* @author dfreer
*/
public class Car {
boolean start = false;
String engine = "";
String brake = "";
private String name = "Herbie";
/** Creates a new instance of Car */
public Car(String eng, String br, String n) {
//constructor
engine = eng;
brake = br;
name = n;
}
public String getEngine()
{
return engine;
}
public void changeEngine(String ch)
{
engine = ch;
}
public boolean startEngine()
{
start = true;
return start;
}
public String getName(){
return name;
}
public static void main(String [] args)
{
Car herbie = new Car("3.8L", "moderate", "George");
System.out.println(herbie.getEngine());
herbie.changeEngine("V8");
System.out.println(herbie.getEngine()+ " is the engine of the new and improved " + herbie.getName());
}
}
Monday, March 10, 2008
Install at home
What is the SDK? Here's a good place to start.
Download eclipse, netbeans, and bluej.
Download JDK 6 Update 5
Find five sites with Sun Certified practice questions online
Third post:
Find five sites that have sample Sun Certified Java Programmer questions and write a review of each of the sites on your blog.
Tuesday, March 4, 2008
As concisely as possibly describe on your blog the purpose of the following site:
Java API.
Second post:
What is the purpose of the Java Virtual Machine?
Wednesday, February 20, 2008
"Everything is easy after you see it done."
Educators, generals, dieticians, psychologists, and parents program. Armies, students, and some societies are programmed. An assault on large problems employs a succession of programs, most of which spring into existence en route. These programs are rife with issues that appear to be particular to the problem at hand. To appreciate programming as an intellectual activity in its own right you must turn to computer programming; you must read and write computer programs -- many of them. It doesn't matter much what the programs are about or what applications they serve. What does matter is how well they perform and how smoothly they fit with other programs in the creation of still greater programs.
-http://mitpress.mit.edu/sicp/full-text/book/book-Z-H-5.html
Sunday, January 20, 2008
Welcome!
Consider this quote:
"Instead of imagining that our main task is to instruct a
computer what to do, let us concentrate rather on explaining to
human beings what we want a computer to do." - Donald Knuth
Think of computer programs as a work of literature. PEOPLE need to be able to understand your code. PEOPLE will update your code. Computers do as they are told. We will focus on communication as well as abstract thinking and algorithm design. Consider this: developers need a sense of aesthetics. Is the GUI completely chaotic? Are users cursing you?
If so, you'll need the communication skills to allay their discomfort and redesign the program.