Java SAmple programsJanuary 27, 2007 11:53 pm

Sample Tester or the main Program

**********************************************************

//Jaquelyn M. Lagbas
//December 5, 2006
//Time and Again

import java.io.*;
import java.util.*;

public class DSAlgo05 extends myTime
{

public static void main (String[] args) throws IOException
 {
  
 System.out.println("===Case #1===");
 
 myTime t1=new myTime();
 
  t1.setTime(14,58,03);
  t1. print();
   System.out.println();
  t1.advance();
  t1.print();
System.out.println();
 t1.advance(3,5,2);
  t1.print();
 System.out.println();
 
  System.out.println("===Case #2===");
 
  myTime t2=new myTime();
  t2.setTime(7,75,98);
 t2.print();
 System.out.println();
  t2.advance();
  t2.print();
System.out.println();
  t2.advance(3,5,2);

  t2.print();
  System.out.println();
 
}
   
}

***********************************************

this is it!!!

time Class

**************************************

import java.io.*;
import java.util.*;

public class myTime 
{
    private int hour;
    private int minute;
    private int second;
  
 
   private int other;
  
    public myTime()
    {

        hour = 0;
        minute = 0;
        second = 0;
        other=0;

    }

    public myTime(int a, int b, int c)
    {
     
        setTime(a, b, c);
      
    }

    public void setTime(int a, int b, int c)
    {
   
        hour = a;
        minute = b;
        second = c;
        
       
    }
   
 ////////////////reset//////////////////
   
    public void reset(int a, int b, int c)
    {
      hour = a;
        minute = b;
        second = c;
    }
   
    public void reset(int a, int b)
    {
      hour = a;
        minute = b;
     
  
   
    }
     public void reset(int a)
    {
      hour = a;
    }
    public void reset()
    {
      hour = 0;
      minute = 0;
      second = 0;
    }
   
////////////////////////////////////////

//////////////////////GET///////////////////////
  public int gethour()
    {  return hour; }   
  public int getminute()
    {  return minute; }
  public int getsecond()
    { return second;}
/////////////////////////////////

   /////////////advance//////////////////
  public void advance(int a, int b, int c)
  {
   
        hour=hour+a;
        minute=minute+b;
        second=second+c;
        normalize();
     }
    
  public void advance()
  {
        hour=hour+0;
        minute=minute+0;
        second=second+1;
        normalize();
  }
  public void advance(int a, int b)
  {
   
        hour=hour+a;
        minute=minute+b;
        normalize();
     }
    public void advance(int a)
  {
   
        hour=hour+a;
        normalize();
     }
 
 
///////////////////////////////////////////////// 
 
  /////////////////nortmalize/////////////////
   
  public  void normalize()
     { 
     while(second>60){second=second%60;  minute++;  }   
     while(minute>60){minute=minute%60; hour++;  }   
     while(hour>12){hour=hour-12; }
    }   
                
   public void print()
    {
     normalize();
        System.out.print (hour + ":" + minute + ":" + second);
    }
}   

This code will let the user advance , reset and normlize the time(12hours)…

Java SAmple programs 11:37 pm

MAIN CLASS

**************************************************

import java.io.*;

class MazeCell {
    public int x, y;
    public MazeCell() {
    }
    public MazeCell(int i, int j) {
        x = i; y = j;
    }
    public boolean equals(MazeCell cell) {
        return x == cell.x && y == cell.y;
    }
}

class Maze {
    private int rows = 0, cols = 0;
    private char[][] store;
    private MazeCell currentCell, exitCell = new MazeCell(), entryCell = new MazeCell();
    private final char exitMarker = ‘e’, entryMarker = ‘m’, visited = ‘.’;
    private final char passage = ‘0′, wall = ‘1′;
    private Stack mazeStack = new Stack();
    public Maze() {
        int row = 0, col = 0;
        Stack mazeRows = new Stack();
        BufferedReader buffer = new BufferedReader(
                                new InputStreamReader(System.in));
        System.out.println("Enter a rectangular maze using the following "
                + "characters:\nm - entry\ne - exit\n1 - wall\n0 - passage\n"
                + "Enter one line at at time; end with Ctrl-z:");
        try {
            String str = buffer.readLine();
            while (str != null) {
                row++;
                cols = str.length();
                str = "1" + str + "1";  // put 1s in the borderline cells;
                mazeRows.push(str);
                if (str.indexOf(exitMarker) != -1) {
                    exitCell.x = row;
                    exitCell.y = str.indexOf(exitMarker);
                }      
                if (str.indexOf(entryMarker) != -1) {
                    entryCell.x = row;
                    entryCell.y = str.indexOf(entryMarker);
                }
                str = buffer.readLine();
            }
        } catch(IOException eof) {
        }
        rows = row;
        store = new char[rows+2][];       // create a 1D array of char arrays;
        store[0] = new char[cols+2];      // a borderline row;
        for ( ; !mazeRows.isEmpty(); row–)
            store[row] = ((String) mazeRows.pop()).toCharArray();
        store[rows+1] = new char[cols+2]; // another borderline row;
        for (col = 0; col <= cols+1; col++) {
            store[0][col] = wall;         // fill the borderline rows with 1s;
            store[rows+1][col] = wall;
        }
    }
    private void display(PrintStream out) {
        for (int row = 0; row <= rows+1; row++)
            out.println(store[row]);
        out.println();
    }
    private void pushUnvisited(int row, int col) {
        if (store[row][col] == passage || store[row][col] == exitMarker)
            mazeStack.push(new MazeCell(row,col));
    }
    void exitMaze(PrintStream out) {
        currentCell = entryCell;
        out.println();
        while (!currentCell.equals(exitCell)) {
            int row = currentCell.x;
            int col = currentCell.y;
            display(System.out);        // print a snapshot;
            if (!currentCell.equals(entryCell))
                 store[row][col] = visited;
            pushUnvisited(row-1,col);
            pushUnvisited(row+1,col);
            pushUnvisited(row,col-1);
            pushUnvisited(row,col+1);
            if (mazeStack.isEmpty()) {
                 display(out);         
                 out.println("Failure");
                 return;
            }
            else currentCell = (MazeCell) mazeStack.pop();
        }
        display(out);
        out.println("Success");
    }
    static public void main (String args[]) {
        (new Maze()).exitMaze(System.out);
    }
}

********************************************************

Stack class

********************************************************

public class Stack {
    private java.util.ArrayList pool = new java.util.ArrayList();
    public Stack() {
    }
    public Stack(int n) {
        pool.ensureCapacity(n);
    }
    public void clear() {
        pool.clear();
    }
    public boolean isEmpty() {
        return pool.isEmpty();
    }
    public Object topEl() {
        if (isEmpty())
            throw new java.util.EmptyStackException();
        return pool.get(pool.size()-1);
    }
    public Object pop() {
        if (isEmpty())
            throw new java.util.EmptyStackException();
        return pool.remove(pool.size()-1);
    }
    public void push(Object el) {
        pool.add(el);
    }
    public String toString() {
        return pool.toString();
    }
}

**********************************************************

SAVE this two classes in the same folder…K?

Sample Input..

11111111111
10000010001
10100010101
e0100000101
10111110101
10101000101
10001010001
11111010001
101m1010001
10000010001
11111111111

Representations

1 - wall

0 - passages

e - exit

m - mouse

mORE more FUn GaMes 4:47 pm

Hey guys! Do you want to try how is it to play Deal or No Deal…

Here’s Joytube.com… not only that, there several games here that you will enjoy playing…promise! I’ve tried it and I really enjoyed playing this onlyn flash games…

click and play… enjoy..

Too much for Girls 3:35 pm

7 Ways to Make Him Ache for You

Sure, you want adoration, respect, and the occasional sparkly treat from your man, but more than anything, you want to feel like he’s still got the hots for you. Well, here’s good news: Contrary to the widely held belief that men lose interest over time, experts now know that guys are actually hardwired for long-term lusting. “It’s absolutely true, but it’s not without conditions,” says Jeffrey Bernstein, PhD, author of Why Can’t You Read My Mind? “You have to make a strategic effort to trigger that craving in him once you’re in a relationship because the spark in your bond won’t last if you neglect it.” For that reason, Cosmo has discovered the seven key make-him-ache-for-you strategies that specifically jumpstart your guy’s desire. Be warned: Once you use them, he’ll be sticking to you like white on rice.

Utter the One Word That Drives Him Nuts As lovey-dovey as pet names make him feel, they still don’t compare to the electrifying rush your man gets when his name crosses your lips. “Just hearing it is an aphrodisiac,” says body-language expert Eve Marx, author of

Read My Hips. “It ratchets up his ­desire because the message you send is ‘It’s you I’m thinking about and no one else.’ And men need to hear that—it’s tied to their primal urge to beat out all the competition.” However, just blurting out his moniker as often as possible isn’t going to do it for him. You need to make it count. For instance, when you’re feeling sexy in a public setting, like in a dark bar, drop it into conversation in surprising spots and pause for a beat or two: “And then…Mark…I slammed the door behind me.” Or try another trick when he’s putting the moves on you: Just kind of coo his name to draw his focus entirely on to you. “When Jake and I are getting it on, sometimes it feels like he’s lost in his own head,” says Andie, 26. “But when I moan his name, everything feels like it gets more intense between us, like it brings him into the moment.”

Reach Into His Pocket for the Keys Well, more than just the keys. The lesson is this: “Never underestimate the power of an unexpected touch,” says David Niven, PhD, author of The 100 Simple Secrets of Great Relationships. “Just by stimulating his nerve endings when he’s not prepared for it, you create a positive physical connection that leaves your man wanting more.” Even better, your guy subconsciously gets hooked on those mini-moments of excitement and craves them when you’re not around. From now on, be on the lookout for opportune moments to touch him “­accidentally.” For example, don’t ask him for his keys…glide your hand into his pocket and slowly take them out. Don’t ask him to pass the salt…reach across him, letting your breasts rub against his arm. Don’t walk past him in a crowded bar…press your rear into his gear. According to Tricia, 25, these sneak attacks work like a charm. “If I’ve been really touchy-feely with Ben, the next morning, he’ll be really snuggly,” she says. “It’s like he wants to be closer to me.” Read more in this month’s issue of Cosmopolitan Philippines.

Internet 12:34 pm

Welcome to your new blog. This is your first post. Edit or delete it, then start blogging!

An email has been sent to you giving you details of how to log in to the administration section. From there you can change the design by clicking on the tab MANAGE and then click on the tab THEMES. If you have any questions, ask them in the forums — we are only too willing to help.

Admin:


Jaque18's ChatRoom




  


Categories:

Archives:

  • January 2007
    S M T W T F S
        Apr »
     123456
    78910111213
    14151617181920
    21222324252627
    28293031  

Most Recent Posts

Most Popular Posts

Meta:


Readers



Display Pagerank

PR Checker






Feeds



Add to Google Reader or Homepage
 Subscribe in a reader
Powered by FeedBurner

Search Engine Optimization and SEO Tools

Community



My Blog's Worth


My blog is worth $193,637.22.
How much is your blog worth?

Visit Counter


business travel insurance
Counter

Babuching





Visits Checker






Other Links




The Caffeine Click Test - How Caffeinated Are You?
Created by OnePlusYou - Free Online Dating

ss_blog_claim=b1325cced1efab080ce8032fa782e1e1