February 20, 2010

Airline Reservation Prototype



Note:Seats marked x are already taken..

February 19, 2010

ACM ICPC contest problems


Typoon Ondoy

On September 26,2009, Typhoon Ondoy brought a month's worth of rainfall to Metro Manila
and nearby areas in just a few hours, causing severe flooding which resulted int eh loss
of many lives and the displacement of hundreds of thousands of people. Areas under
Storm Signal No.2 included:Aurora,Quirino,Nueva Vizcaya, Nueva Ecija,Pangasinan, Tralac,
Zambales,Pampanga, bulacan, Rizal,Northern Quezon, and Polillo Island.The Philippine Atmospheric Geophysical and Astronomical Services Administration (PAG-ASA)
has come up with a measure to classify typhoons based on wind speed (in kph):
Tropical depression have wind speeds of 30 to 46 kph (inclusive)
Tropical storms have wind speeds between 47 kph and 89 kph (inclusive)
Typhoons have wind speeds between 90 kph and 183 kph (inclusive)
Super Typhoons have wind speeds greater than 183 kph
Programmer Oliver
Decembe 10,2009

+++++++++++++++++++++++++++++++++++++++++
import java.util.*;
public class TyphoonOndoy
{
static Scanner console=new Scanner (System.in);
public static void main()
{
int windSpeed;
System.out.print("Enter Wind Speed (in kph)>>\t\n");
windSpeed=console.nextInt();
if (windSpeed>183)
System.out.print("It is a Super typhoon");
else if(windSpeed>90)
System.out.print("It is a Typhoon");
else if (windSpeed>47)
System.out.print("It is a Tropical Storm");
else if (windSpeed>30)
System.out.print("It is a Tropical Depression");
else
System.out.print("No classification for this wind speed");
}
}
Preview



/**
* This program will determine the Easter Sundays in a given year from 1900-2099.
*
* Programmer Oliver December 2,2009
*/
import java.util.*;
public class Eastern
{
static Scanner console=new Scanner(System.in);
public static void main ()
{
int year;
int a,b,c,d,e;
int date;
String MonthName;
System.out.println("Enter year");
year=console.nextInt();
a=year%19;
b=year%4;
c=year%7;
d=(19*a+24)%30;
e=(2*b+4*c+6*d+5)%7;
date=22+d+e;
if (date>31)
{
MonthName="April";
date=d+e-9;
if ((d+e+22)==57)
date=date-7;
}
else if (date==31)
{
MonthName="April";
}
else
MonthName="March";
System.out.printf("Easter Sunday is %s %2d,%3d\n",MonthName,date,year);
}
}

February 17, 2010

Java Tuts site for Beginners to become Experts!

from the source(creators of java)
  http://java.sun.com/docs/books/tutorial/
others:
http://home.cogeco.ca/~ve3ll/jatutor0.htm

But its better if you read books about java.
Authors like Gosling are the best!
Or don't hesitate to approach me through the net
or meet me in person so that i could simplify further what the sites or books are talking about. I love teaching because it also enhances my expertise in java programming

February 06, 2010

Decimal number to Roman Numeral Converter(Java program)

import java.util.*;
public class Roman_Numerals
{
static Scanner console=new Scanner(System.in);
public static void main()
{
int num;
int ctr;
int ones_place;
int tens_place;
int hundreds_place;
int thousands_place;
System.out.println("Enter your desired number (1-10,999)");
num=console.nextInt();
ones_place=num%10;
tens_place=num%100/10;
hundreds_place=num%1000/100;
thousands_place=num%10000/1000;
//thousand's place
if (num/10000==1)
System.out.print("XO");
else if (thousands_place==9)
System.out.print("MXO");
else if(thousands_place>5&&thousands_place<9)
{
System.out.print("XO");
for (ctr=0;ctr System.out.print("M");
}
else if (thousands_place==5)
System.out.print("VO");
else if (thousands_place==4)
System.out.print("IVO");
else if (thousands_place<4)
for (ctr=0;ctr System.out.print("M");

//hundred's place
if (hundreds_place==9)
System.out.print("CM");
else if(hundreds_place>5&&hundreds_place<9)
{
System.out.print("D");
for (ctr=0;ctr System.out.print("C");
}
else if (hundreds_place==5)
System.out.print("D");
else if (hundreds_place==4)
System.out.print("CD");
else if (hundreds_place<4)
for (ctr=0;ctr System.out.print("C");
//ten's place
if (tens_place==9)
System.out.print("XC");
else if(tens_place>5&&tens_place<9)
{
System.out.print("L");
for (ctr=0;ctr System.out.print("X");
}
else if (tens_place==5)
System.out.print("L");
else if (tens_place==4)
System.out.print("XL");
else if (tens_place<4)
for (ctr=0;ctr System.out.print("X");
//one's place
if (ones_place==9)
System.out.print("IX");
else if(ones_place>5&&ones_place<9)
{
System.out.print("V");
for (ctr=0;ctr System.out.print("I");
}
else if (ones_place==5)
System.out.print("V");
else if (ones_place==4)
System.out.print("IV");
else if (ones_place<4)
for (ctr=0;ctr System.out.print("I");


}

}

+Perfect Numbers+Java Program

/**
* Find the perfect numbers from 1 to 32767
*
* @author (Oliver Tamboboy)
* @version (November 8,2009)
*/
import javax.swing.*;
public class PerfectNumbers
{
public static void main (String[]args)
{
String outStr="The perfect numbers from 1-32767 are:";
int k=1,sum,k2;
JOptionPane.showMessageDialog(null,outStr,"Perfect Numbers",
JOptionPane.INFORMATION_MESSAGE);
do
{
k++;
sum=0;
for(k2=1;k2<=k/2;k2++)
{
if(k%k2==0)
sum=sum+k2;
}
if (sum==k)
JOptionPane.showMessageDialog(null,sum,"",JOptionPane.ERROR_MESSAGE);
}while(k<=32767);
}
}