Thursday, May 1, 2008
Homemade JVM
It seems that the author was trying to create his own, but limited, Java Virtual machine(JVM). He seemed to be torn between working with another project he had going called Morpheus and the JVM. His coding was above anything I have done or seen so far. It was an interesting read and I tried following along with how he broke down each section. Still though, it is quite a bit to digest at my current level. If there is a JVM available, not sure why someone would want to build another one from scratch. Guess he liked the challenge.
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."); }}
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));
}
}
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.
Sunday, April 6, 2008
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
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.
Sunday, March 23, 2008
Sunday, March 16, 2008
Sun Certified Practice Questions
1. I found the UCertify site to be rather helpful for getting some exposure to the Sun Certified test. They allow you to download a practice exam and you have the option to review your answers either right after you answer each one or at the end of all the questions. However, there is a fuller version that you have to buy in order to get the full benefit of what they offer. It is a bit of a teaser, but you do get a chance to see what kind of questions are asked on the exam.
2. This website is from the about.com site and they give you 29 questions to answer and they also provide several other links to other free Sun certified practice questions. I liked the simplicity of the site and the variety of the questions they asked.
3. Javacertificate.com provides sample questions for the Sun Certified exam and after each question they let you know how many questions you got right or wrong and tallies them as you proceed from question to question. They also let you know how much time has elapsed. I find this gives a better feel for the real exam and you get to see how well you are doing after each question.
4. Geocities offers a 30 question practice exam and they also give you answer with an a brief explanation why that is the correct answer. There is a drop-down window that allows you to skip to another question. You write down your answers on a piece of paper and you can check to see how many you got right. Overall, this is a good site, but you do have to get additional resources in order to write your answers down. There is not an option to answer on the computer.
5. Javaprepare.com offers a number of options on their site that can prepare you for the Certification exam. They offer two different test, FAQ, and a tutorial to help you better understand the Java language. They have charts and go into some detail about the Java language. This site is a wonderful complement to preparing for the Sun certified exam. I really like all the information they give you. Check it out!
2. This website is from the about.com site and they give you 29 questions to answer and they also provide several other links to other free Sun certified practice questions. I liked the simplicity of the site and the variety of the questions they asked.
3. Javacertificate.com provides sample questions for the Sun Certified exam and after each question they let you know how many questions you got right or wrong and tallies them as you proceed from question to question. They also let you know how much time has elapsed. I find this gives a better feel for the real exam and you get to see how well you are doing after each question.
4. Geocities offers a 30 question practice exam and they also give you answer with an a brief explanation why that is the correct answer. There is a drop-down window that allows you to skip to another question. You write down your answers on a piece of paper and you can check to see how many you got right. Overall, this is a good site, but you do have to get additional resources in order to write your answers down. There is not an option to answer on the computer.
5. Javaprepare.com offers a number of options on their site that can prepare you for the Certification exam. They offer two different test, FAQ, and a tutorial to help you better understand the Java language. They have charts and go into some detail about the Java language. This site is a wonderful complement to preparing for the Sun certified exam. I really like all the information they give you. Check it out!
Java Virtual Machine
The Java Virtual Machine (JVM) allows the Java program to be run on any platform or operating system. It is a set of computer software programs that protects users from malicious software by running them in a virtual environment. This allows for great portability from one system to another.
Java API
The purpose of the Java 2 Platform SE 5.0 API is that it lists all the packages, classes, methods, constructors, errors and obsolete code that is available for use in the Java language. It is quite extensive and is a great reference tool to help with programming in Java. When looking at a specific class it is further broken down in a tree format and continues to branch out as you find the specific method you want to employ in your code. This is a powerful tool that helps the novice user to Java and the seasoned Java programmer to access an array of commands that would be virtually impossible to memorize.
Tuesday, March 11, 2008
My History
My name is Hassien and this is my first time learning Java. I have just recently completed the C++ class. Right now I am studying to become an electrical engineer, but I am starting to rethink about going into some IT field. I am hoping that after this class it will really help me to decide if I want to continue engineering or go into the IT field.
Subscribe to:
Posts (Atom)
