Try this fun test. Put on your blog how you do.
Write your impressions of the site on your blog and your score if available.
Monday, July 27, 2009
See how fast you can type
Put your WPM on your blog.
Click here. Do a 1 minute test and copy and paste the results on your blog.
Test completed - here are your results:
Net Speed: 78 WPM
(words/minute)
Accuracy: 98%
Gross Speed: 79 WPM
(words/minute)
Print results
Click here. Do a 1 minute test and copy and paste the results on your blog.
Test completed - here are your results:
Net Speed: 78 WPM
(words/minute)
Accuracy: 98%
Gross Speed: 79 WPM
(words/minute)
Print results
Wednesday, July 22, 2009
Project euler code!
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package projecteuler;
/**
A palindromic number reads the same both ways.
* The largest palindrome made from the product of two 2-digit numbers is 9009 = 91 × 99.
Find the largest palindrome made from the product of two 3-digit numbers.
*/
import java.util.*;
public class palindrome {
public static void main(String [] args)
{
//discover whether a number is a palindrome...
int first3digit = 1000;
int second3digit = 1000;
boolean keepGoing = true;
int counter = 0;
ArrayList arrayList = new ArrayList();
for(int i = 1000; i > 0; i--)
{
for(int j = 1000; j > 0; j--)
{
if(isPalindrome(i*j))
arrayList.add(i*j);
}
}
int largest = arrayList.get(0);
for(int x = 0; x< arrayList.size(); x++)
{
if(arrayList.get(x) > largest)
{
largest = arrayList.get(x);
}
}
System.out.println(largest + " is the largest");
/*
while(keepGoing == true)
{
if(isPalindrome(first3digit * second3digit))
{
System.out.println(first3digit);
System.out.println(second3digit);
counter++;
}
if(counter % 2 == 1)
{
--first3digit;
}
else
{
--second3digit;
}
if(counter == 1000000000)
{
keepGoing = false;
}
if(first3digit < 0 || second3digit < 0)
{
keepGoing = false;
}
// System.out.println(first3digit);
// System.out.println(second3digit);
counter++;
}
*/
}
public static boolean isPalindrome(Integer c)
{
String a = c.toString();
boolean b = true;
for(int i = 0; i < a.length()-1; i++)
{
if(a.charAt(i) == a.charAt(a.length()-i-1))
{
//System.out.println("We've got a match!");
}
else
{
b = false;
}
}
if(b == true)
{
System.out.println("This " + a + " is a palindrome.");
return true;
}
else
{
//System.out.println("This " + a + " is not a palindrome.");
return false;
}
}
}
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package projecteuler;
/**
A palindromic number reads the same both ways.
* The largest palindrome made from the product of two 2-digit numbers is 9009 = 91 × 99.
Find the largest palindrome made from the product of two 3-digit numbers.
*/
import java.util.*;
public class palindrome {
public static void main(String [] args)
{
//discover whether a number is a palindrome...
int first3digit = 1000;
int second3digit = 1000;
boolean keepGoing = true;
int counter = 0;
ArrayList
for(int i = 1000; i > 0; i--)
{
for(int j = 1000; j > 0; j--)
{
if(isPalindrome(i*j))
arrayList.add(i*j);
}
}
int largest = arrayList.get(0);
for(int x = 0; x< arrayList.size(); x++)
{
if(arrayList.get(x) > largest)
{
largest = arrayList.get(x);
}
}
System.out.println(largest + " is the largest");
/*
while(keepGoing == true)
{
if(isPalindrome(first3digit * second3digit))
{
System.out.println(first3digit);
System.out.println(second3digit);
counter++;
}
if(counter % 2 == 1)
{
--first3digit;
}
else
{
--second3digit;
}
if(counter == 1000000000)
{
keepGoing = false;
}
if(first3digit < 0 || second3digit < 0)
{
keepGoing = false;
}
// System.out.println(first3digit);
// System.out.println(second3digit);
counter++;
}
*/
}
public static boolean isPalindrome(Integer c)
{
String a = c.toString();
boolean b = true;
for(int i = 0; i < a.length()-1; i++)
{
if(a.charAt(i) == a.charAt(a.length()-i-1))
{
//System.out.println("We've got a match!");
}
else
{
b = false;
}
}
if(b == true)
{
System.out.println("This " + a + " is a palindrome.");
return true;
}
else
{
//System.out.println("This " + a + " is not a palindrome.");
return false;
}
}
}
Extra credit
A palindromic number reads the same both ways. The largest palindrome made from the product of two 2-digit numbers is 9009 = 91 99.
Find the largest palindrome made from the product of two 3-digit numbers.
Add 3 points to the final.
Find the largest palindrome made from the product of two 3-digit numbers.
Add 3 points to the final.
Searching through data
Selection sort
Insertion sort
Merge sort
Quicksort : how does it select the pivot value?
Binary search
Try to explain each algorithm in layman's terms and give the efficiency of the algorithm (Big O notation). Include a useful link if you found it.
Insertion sort
Merge sort
Quicksort : how does it select the pivot value?
Binary search
Try to explain each algorithm in layman's terms and give the efficiency of the algorithm (Big O notation). Include a useful link if you found it.
Monday, July 20, 2009
Please answer on your blog...
- What is a stack?
- What is a linked list?
- What is a queue?
- How is a linked list related to an ArrayList?
Final Project
For your final project I would like you to make a program using Java. It can be a desktop or console based program.
What you choose is up to you, however, it must not be a trivial program. To ensure it is not trivial, email me your specs before Wednesday.
Due July 31st.
Final July 29th, 2009.
What you choose is up to you, however, it must not be a trivial program. To ensure it is not trivial, email me your specs before Wednesday.
Due July 31st.
Final July 29th, 2009.
Wednesday, July 15, 2009
try catch
public void addTwoPlusTwo() {
int num1, num2;
try{
String text1 = jTextField1.getText();
String text2 = jTextField2.getText();
num1 = Integer.parseInt(text1);
num2 = Integer.parseInt(text2);
JOptionPane.showMessageDialog(null, num1+num2);
JOptionPane.showMessageDialog(null, "Example JOptionPane!");
}catch(Exception e)
{
JOptionPane.showMessageDialog(null, "You need numbers");
}
}
int num1, num2;
try{
String text1 = jTextField1.getText();
String text2 = jTextField2.getText();
num1 = Integer.parseInt(text1);
num2 = Integer.parseInt(text2);
JOptionPane.showMessageDialog(null, num1+num2);
JOptionPane.showMessageDialog(null, "Example JOptionPane!");
}catch(Exception e)
{
JOptionPane.showMessageDialog(null, "You need numbers");
}
}
To open a new Form...
To add a new form:
Right click on your package and go to "Other".
Click on "Swing Gui Forms" and add a JFrame Form.
Then inside your button the code is:
new NewJFrame().setVisible(true);
Right click on your package and go to "Other".
Click on "Swing Gui Forms" and add a JFrame Form.
Then inside your button the code is:
new NewJFrame().setVisible(true);
Desktop application!
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 a Desktop application and upload it to FreerSchools.com.
Minor project work with a partner or two or by yourself.
Here is how to make a Panel background image:
Click here and read the solution at the bottom.
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 a Desktop application and upload it to FreerSchools.com.
Minor project work with a partner or two or by yourself.
Here is how to make a Panel background image:
Click here and read the solution at the bottom.
Monday, July 13, 2009
Fib numbers
1, 1, 2, 3, 5, 8, 13, 21, 34, 55
try to figure out how to calculate the series without recursion...Only use loops.
try to figure out how to calculate the series without recursion...Only use loops.
Monday, July 6, 2009
try {
FileReader read = new FileReader("namesToReadIn.txt");
BufferedReader readIn = new BufferedReader(read);
String line = ""; String total = "";
while((line = readIn.readLine()) != null)
{ System.out.println(line);
total += line;
}
String [] allTheNames = total.split(",");
System.out.println("There were " + allTheNames.length + " names read in"); } catch (IOException e)
{ System.out.println(e); }
FileReader read = new FileReader("namesToReadIn.txt");
BufferedReader readIn = new BufferedReader(read);
String line = ""; String total = "";
while((line = readIn.readLine()) != null)
{ System.out.println(line);
total += line;
}
String [] allTheNames = total.split(",");
System.out.println("There were " + allTheNames.length + " names read in"); } catch (IOException e)
{ System.out.println(e); }
Wednesday, July 1, 2009
Minor Assignment
Create a new database and a table with two or three things.
Connect it to a Netbeans front end and show me it works. Upload it to FreerSchool.com :)
Connect it to a Netbeans front end and show me it works. Upload it to FreerSchool.com :)
MySQL and Java
-------Next, create a database for students using MySQL and a table with some information.
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')";
Then create a java program (using Netbeans) and show you are able to update it and delete data from the database.
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')";
Then create a java program (using Netbeans) and show you are able to update it and delete data from the database.
BlackJack due July 7th
I would like you to work with one or two other students on the BlackJack program.
You may make it console or GUI based.
Due July 7th on FreerSchool.com.
Have fun!
You may make it console or GUI based.
Due July 7th on FreerSchool.com.
Have fun!
Subscribe to:
Posts (Atom)