Likefunny2007’s Weblog

Just another WordPress.com weblog

MY JAVA PROJECT-Fractal 十二月 4, 2007

Filed under: java programme — likefunny2007 @ 3:51 am

~ The Fractal gennarator~

law_project1.jpg

Link to see: http://hk.geocities.com/kwan_ism001/my_project.html

Download the source code: kwan_project.doc

If you feel interest about this project topic ,you can read more detail from this website:

http://en.wikipedia.org/wiki/Fractal

 

2nd Homework-The Fighters’ Universe 十二月 4, 2007

Filed under: java programme — likefunny2007 @ 3:21 am

homework2.jpg 

Download Source Code here:

Player.java :  http://pastebin.ca/813054

FightersUniverse.java : http://pastebin.ca/813057

BossPlayer.java : http://pastebin.ca/813058

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

This is an advanced fighter game.
There are four players.
Two of them are ordinary players.They are Andy and Peter.
The other two are boss players.They are Rain and Elsa.
For this time,the initial power is 10.
one player is selected by random to attack another random player.
If a player chosen is already dead in previous rounds,
or a player is selected to attack himself/herself,
then select another player.

  • When Boss players lose an attack, they only lose half of the power difference ><
  • When Boss players win an attack,they can gain double the power difference ><

If the power to be reduced is not an integer.e.g.2.5,it will rounded down to 2.
If the difference is zero , difference is 1.This is same as the simple fighter.
When any player’s power is negative,the player is dead ><
The game will stop
Then print out “Game over” and each players’ power…

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

 

1st homwork–Java Simple Text Fighter! v2007 十月 17, 2007

Filed under: java programme — likefunny2007 @ 3:08 pm

simple-fighter.JPG

DOWNLOAD Source Code –>  player.doc

Below is the SAMPLE output :

Java Simple Text Fighter! v20070928

========= Round1 =========
Player  Andy  ’s power = 100
Player  Peter  ’s power = 100
Andy attacks Peter!
Congutulation !  Andy wins !
========= Round2 =========
Player  Andy  ’s power = 101
Player  Peter  ’s power = 99
Andy attacks Peter!
Sorry !  Andy loses !
========= Round3 =========
Player  Andy  ’s power = 97
Player  Peter  ’s power = 103
Andy attacks Peter!
Sorry !  Andy loses !
========= Round4 =========
Player  Andy  ’s power = 103
Player  Peter  ’s power = 97
Andy attacks Peter!
Congutulation !  Andy wins !
========= Round5 =========
Player  Andy  ’s power = 97
Player  Peter  ’s power = 103
Andy attacks Peter!
Congutulation !  Andy wins !
========= Round6 =========
Player  Andy  ’s power = 91
Player  Peter  ’s power = 109
Andy attacks Peter!
Sorry !  Andy loses !
========= Round7 =========
Player  Andy  ’s power = 73
Player  Peter  ’s power = 127
Andy attacks Peter!
Sorry !  Andy loses !
========= Round8 =========
Player  Andy  ’s power = 127
Player  Peter  ’s power = 73
Andy attacks Peter!
Congutulation !  Andy wins !
========= Round9 =========
Player  Andy  ’s power = 181
Player  Peter  ’s power = 19
Andy attacks Peter!
Congutulation !  Andy wins !
Peter is killed!
======= ! Game over! ======
Player  Andy  ’s power = 343
Player  Peter  ’s power = -143

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

This is a simple fighter game.
There are two players.One is Andy,another is Peter..
Their initial power is 100
I set Andy attacks Peter in each round
At the beginning of the game..
it will show out Andy and Peter’s power..
then Andy attacks Peter
After attacked,
the program will determine weather Andy win or lose by “random genarator”
and print out Andy wins or loses!
At the same time,
program will update the players’power
winner:gain the difference of players original power
loser:lose the difference of players original power
If the difference is zero , difference is 1…
When any player’s power is negative,the player is dead ><
The game will stop
Then print out “Game over” and players’ power…

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

 

chapter.2 exercise 2.25 九月 19, 2007

Filed under: java programme — likefunny2007 @ 4:44 pm

以下是第二課 練習

題目要求是寫一程式顯示一個整數是單數或是雙數

————————————————————–

// exercise 2.25: Remainder.java
// Remainder program that determines an integer whether it is odd or even
import java.util.Scanner; // program uses class Scanner

public class Remainder
{
   // main method begins execution of Java application
   public static void main( String args[] )
   {
      // create Scanner to obtain input from command window
      Scanner input = new Scanner( System.in );

      int number; // number to deterimine
      int remainder; // remainder of number

    

      System.out.print( “Please enter an integer: ” ); // prompt
      number = input.nextInt(); // read number from user
     
      remainder = number % 2; //remainder

      System.out.printf( “Remainder is %d\n”, remainder ); // display remainder

      if ( remainder == 0 )
         System.out.printf( “%d = even number“, number );

      if ( remainder != 0 )
         System.out.printf( “%d = odd number“, number );

    } // end method main

} // end class Remainder

————————————————————–

程式介面會顯示 Please enter an integer:

之後使用者需輸入一個整數

然後電腦就會判斷輸入的整數是單數或是雙數

例如使用者輸入的數字是7

7是單數

便會顯示:

Remainder is 1 

7=odd number

例如使用者輸入的數字是8

8是雙數

便會顯示 :

Remainder is 0

8=even number

 

勇往直前 九月 19, 2007

Filed under: shareings — likefunny2007 @ 4:18 pm

勇往直前 ! !

I am LAW MEI KWAN

student number:8048955