Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more
Download
Standard view
Full view
of .
Save to My Library
Look up keyword
Like this
1Activity
0 of .
Results for:
No results containing your search query
P. 1
Computer Programming

Computer Programming

Ratings: (0)|Views: 2 |Likes:
Published by Bank
Computer Programming

1)
public class TestIfElse { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub new TestIfElse().calGrade(72); System.out.println(); new TestIfElse().calGrade(49); } public void calGrade(int points) { if (points > 50) { System.out.println("Your points more than 50"); System.out.println("Not Fail"); } else { System.out.println("Your points less than 50"); System.out.println(" Fail !!!"); }
Computer Programming

1)
public class TestIfElse { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub new TestIfElse().calGrade(72); System.out.println(); new TestIfElse().calGrade(49); } public void calGrade(int points) { if (points > 50) { System.out.println("Your points more than 50"); System.out.println("Not Fail"); } else { System.out.println("Your points less than 50"); System.out.println(" Fail !!!"); }

More info:

Published by: Bank on Nov 19, 2009
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as DOCX, PDF, TXT or read online from Scribd
See more
See less

01/06/2011

pdf

text

original

 
MR. MAMPAN SANGSA 50052535 
วิชา
Computer Programming1)
 public
 
class
TestIfElse {/** * 
@param 
 args */
 public
 
static
 
 void 
main(String[] args) {//
TODO
Auto-generated method stub
new
TestIfElse().calGrade(72);System.
out
.println();
new
TestIfElse().calGrade(49);}
 public
 
 void 
calGrade(
int
points) {
if
(points > 50) {System.
out
.println("Your points more than 50");System.
out
.println("Not Fail");}
else
{System.
out
.println("Your points less than 50");System.
out
.println(" Fail !!!");}System.
out
.println("End calGrade");}}
ผลลัพธ์ของโปรแกรม
Your points more than 50Not FailEnd calGradeYour points less than 50Fail !!!End calGrade
2)
 public
 
class
TestMultiDimesionArray {/** * 
@param 
 args */
 public
 
static
 
 void 
main(String[] args) {
 
int
number[][] =
new
 
int
[10][];
int
count = 1;
int
num = 1;
for
(
int
i = 0; i < 10; i++) {number[i] =
new
 
int
[count++];
for
(
int
j = 0; j <= i; j++) {number[i][j] = num++;System.
out
.println(number[i][j] +"\t");}System.
out
.println();}}}
ผลลัพธ์ของโปรแกรม
123456789101112131415161718192021222324252627282930313233 34353637383940414243444546474849505152535455
3)
 public
 
class
TestArray {/** * 
@param 
 args */
 public
 
static
 
 void 
main(String[] args) {
char
s[];s=
new
 
char
[26];//
สร้างอาร์เรย์ของชนิดข้อมู
char
ขนาด
26
ช่อง
for
(
int
i=0; i<s.length; i++){/*s.length
 ใช้หาขนาดอาร์เรย์
s*/s[i]=(
char
)('A'+i);/*
กำาหนดค่าอักษรให้แต่ละช่องของอาร์เรย์
s*/}
for
(
int
i=0; i<s.length; i++){System.
out
.print(s[i]+"\t");/*
พิมพ์ของค่าอาร์เรย์ออกมาที ละช่อง
*/
 
}}}
ผลลัพธ์ของโปรแกรม
ABCDEFGHIJKLMNOPQRSTUVWXYZ
4)
 public
 
class
TestConcatString {/** * 
@param 
 args */
 public
 
static
 
 void 
main(String[] args) {String msg1="Hello!";String msg2="Every body";String name1="My name is Sangsa.";String name2="I come from Cambodia.";String name3="I'm study at Burapha University.";System.
out
.println(msg1);System.
out
.println(msg2);System.
out
.println(
 
name1);System.
out
.println(name2);System.
out
.println(name3);}}
ผลลัพธ์ของโปรแกรม
Hello!Every bodyMy name is Sangsa.I come from Cambodia.I'm study at Burapha University.
5)
 public
 
class
TestGrade {

You're Reading a Free Preview

Download
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->