Tuesday, April 29, 2008

Final Project update

My final project is based on a choose-your-own-adventure format. I am under the gun to get it finished before the class is over...no pressure. I am working out the details right now and hopefully I will have it coded before time runs out. That's all for now.

Coding using NotePad

/* Using simply notepad (and without looking on the Internet) create a program that will keep track of a car's mileage, mph, gas in the tank, and the known sum spent on gas. You will create methods to simulate driving a certain distance. The program must calculate the miles driven and the gas left in the tank. The same method should also allow for the user to enter in the price of gas, which will be kept in a variable.
Download this. Open it with BlueJ.
*/
import java.util.Scanner;
public class CarSimulator{ private int mileage = 0; private int miles_per_hour = 0; private int gasTank = 0; private double gasTotal = 0; private double gasPrice = 0; private int miles_per_gallon = 0; public CarSimulator(int mpg, int gas_in_tank) { miles_per_gallon = mpg; gasTank = gas_in_tank; }
public double getGasTotal() { Scanner in = new Scanner(System.in); System.out.print("Please enter the price of gas: "); gasPrice = in.nextDouble(); gasTotal = gasPrice * gasTank; return gasTotal; }
public int distance() { mileage = miles_per_gallon * gasTank; return mileage; }
public int gasLeft() { gasTank = gasTank - (int)mileage/gasTank; return gasTank; }
public static void main(String[] args) { CarSimulator vehicle = new CarSimulator(25, 16); System.out.println("The distance you can travel is " + vehicle.distance() + " miles."); }}

Sun Developer Quiz

Not a bad quiz. I got 7 out of 10 questions right. Gives me a chance to gauge where I am learning Java. I'd recommend that people try the quiz.

Thursday, April 24, 2008

Recursive Examples

public class RecursiveArray {
static double temp = 0;
public static double max(double[] array, int n)
{
if (n == 0)
return array[0];
else if (array[n] < array[--n])
temp = array[n];
n -= 1;
return temp;
}
public static void main(String[] args)
{
double[] array = {23.4, 45.9, 5.3,77.3, 5.4, 8.5, 45.6};
System.out.println(max(array,4));
}
}

Tuesday, April 22, 2008

Final Project

I would like to make choose-your-own-adventure game that allows the person to choose from several endings. Just a quick idea...more to come.

Recursion Diagram


Which way is she turning?

I see her turning clockwise. I guess that means I am right-brained.

Saturday, April 5, 2008

Blog Assignment 4

Coding Horror

When I first started reading this I was curious about what Jeff Atwood, Coding Horror's author, meant when he was writing about mousing surface theory. It was an amusing article and he did give some good points to determine whether you need a mousepad or not. He also gave some recommendations of mousepads that offer a bit of variety depending on the user's taste. I liked the Razer ExactMat that he shows a picture of. Looks really cool. (Hey, where did he get that mouse from?) Anyway, check out the site and see if you like anything there.

Here's the link to the blog about mousing surfaces.
http://www.codinghorror.com/blog/archives/001092.html

Google Public Policy Blog

This was an interesting article from the Google blog. In this day and age, when people are concerned about their privacy and the danger of their information being stolen and used maliciously, it's nice to read that Google is taking steps to make sure that our server logs are being secured diligently. In the article, which seems to be an ongoing series geared towards safeguarding your information, the author details the steps being taken to ensure our information, stored on their servers, does not fall into the wrong hands. Although there are some opponents to Google having certain information, such as IP addresses for 18 months or more, it is good to see that Google is making an attempt to keep our information private. Check out the blog and see what you think.

Link for the blog article:
http://googlepublicpolicy.blogspot.com/2008/03/using-log-data-to-help-keep-you-safe.html

TechMeme

Who knew that blogging could be a cause of death? In this blog article, Matt Richtel, of the New York Times, details the burden some people place themselves under to earn a living writing blogs. Mr. Richtel cited an instance where two well know bloggers died recently and there is some speculation that is was due to the stress of maintaining a blog that was read by thousands of readers. People get paid by how many times their blog have been clicked, while others get paid by the number of blogs they have going. As with any business, there are the people that strike it rich, while others just barely scrape by. This article does bring attention to the fact of the different stressors involved with writing and maintaining a blog site. It just reminds me of the fact that despite it all it is very important for people to be well rested and not chase after the greenback, or whatever form of currency, you crave. The bible does say that the love of money is the root of all kinds of evil. Although, information is power, we find that too much information could kill. See what you think.

http://www.nytimes.com/2008/04/06/technology/06sweat.html?ei=5088&en=b9031b1ab51405e4&ex=1365134400&partner=rssnyt&emc=rss&pagewanted=all


Friday, April 4, 2008

Guessing Game

This is the link to my guessing game. Feel free to copy it and paste it to your favorite Java SDK.

Tuesday, April 1, 2008

My feelings about BlueJ

I think BlueJ really helps to solidify how object oriented programming is done. Not only do you get to write the code, but it also allows you to see the actual object as the program runs. I'm still learning about all the features that BlueJ has to offer.