<?php $salary = "5000"; if($salary <= 10000) { $tax = $salary *(4/100) ; echo "คุณมีเงินเดือน :: ".$salary." บาท ต้องเสียภาษี :: ".$tax." บาท"; }elseif( $salary <=20000) { $tax = $salary *(5/100) ; echo "คุณมีเงินเดือน :: ".$salary." บาท ต้องเสียภาษี :: ".$tax." บาท"; }elseif( $salary <=30000) { $tax = $salary *(7/100) ; echo "คุณมีเงินเดือน :: ".$salary." บาท ต้องเสียภาษี :: ".$tax." บาท"; }else{ $tax = $salary *(10/100) ; echo "คุณมีเงินเดือน :: ".$salary." บาท ต้องเสียภาษี :: ".$tax." บาท"; } ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=tis-620" /> <title>Untitled Document</title> </head> <body> <form id="form1" name="form1" method="post" action="test2.php"> ชื่อ-สกุล <input name="name" type="text" id="name" value="<?=$_POST['name']?>" /> <p>ชื่อบริษัทที่ทำงาน <input name="office" type="text" id="office" value="<?=$_POST['office']?>" /> </p> <p>เงินเดือน <input name="salary" type="text" id="salary" value="<?=$_POST['salary']?>" /> </p> <p> <input type="submit" name="submit" id="submit" value="คำนวณ" /> </p> <p> </p> </form> </body> </html>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=tis-620" /> <title>Untitled Document</title> </head> <body> <? if($_POST['submit']) { $name = $_POST['name']; $office= $_POST['office']; $salary = $_POST['salary']; ?> <?php $salary = "5000"; if($salary <= 10000) { $tax = $salary *(4/100) ; echo "คุณมีเงินเดือน :: ".$salary." บาท ต้องเสียภาษี :: ".$tax." บาท"; }elseif( $salary <=20000) { $tax = $salary *(5/100) ; echo "คุณมีเงินเดือน :: ".$salary." บาท ต้องเสียภาษี :: ".$tax." บาท"; }elseif( $salary <=30000) { $tax = $salary *(7/100) ; echo "คุณมีเงินเดือน :: ".$salary." บาท ต้องเสียภาษี :: ".$tax." บาท"; }else{ $tax = $salary *(10/100) ; echo "คุณมีเงินเดือน :: ".$salary." บาท ต้องเสียภาษี :: ".$tax." บาท"; } } ?> </body> </html>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=tis-620" /> <title>Untitled Document</title> </head> <body> <? if($_POST['submit']) { $name = $_POST['name']; $office= $_POST['office']; $salary = $_POST['salary']; //คุณก็ echo ค่าที่ต้องการออกมา echo $name; echo $office; echo $salary ; ?> <?php $salary = "5000"; //อันนี้ตัวอย่างผมสมมุติตัวแปร คุณจะทำไงลองนึกดูนะครับ if($salary <= 10000) { $tax = $salary *(4/100) ; echo "คุณมีเงินเดือน :: ".$salary." บาท ต้องเสียภาษี :: ".$tax." บาท"; }elseif( $salary <=20000) { $tax = $salary *(5/100) ; echo "คุณมีเงินเดือน :: ".$salary." บาท ต้องเสียภาษี :: ".$tax." บาท"; }elseif( $salary <=30000) { $tax = $salary *(7/100) ; echo "คุณมีเงินเดือน :: ".$salary." บาท ต้องเสียภาษี :: ".$tax." บาท"; }else{ $tax = $salary *(10/100) ; echo "คุณมีเงินเดือน :: ".$salary." บาท ต้องเสียภาษี :: ".$tax." บาท"; } } ?> </body> </html>
import java.util.Scanner; class Ex16 { public static void main(String args[]) { //String a[]=new String[5]; String a,b,c,d; int e,f; Scanner input=new Scanner(System.in); //for(int i=0;i<a.length;i++) System.out.print("Employee ID \t\t: "); a=input.nextLine(); System.out.print("Employee Name \t\t: "); b=input.nextLine(); System.out.print("Employee Address \t: "); c=input.nextLine(); System.out.print("Employee Phone \t\t: "); d=input.nextLine(); System.out.print("Salary \t\t\t: "); e=input.nextInt(); System.out.print("Bonus \t\t\t: "); f=input.nextInt(); System.out.println("**********************SHOW DATA********************"); System.out.println("Employee ID : "+a); System.out.println("Employee Name : "+b); System.out.println("Employee Address : "+c); System.out.println("Employee Phone : "+d); System.out.println("Employee Salary : "+e); System.out.println("Employee Bonus : "+f); //deduct=e-Vat; //int total; //total=(e-Vat); //int Vat[]=new int Vat[3]; //for(int i=0;i<Vat.length;i++) if(e>=30000) { int Vat=e-(e*5)/100; System.out.println("Salary>30000 Deduct Vat 5% \t: " +Vat); } if(e>=20000 && e<30000) { int Vat=e-(e*4)/100; System.out.println("Salary 20000-29999 Deduct Vat 4% \t: " +Vat); } if(e>=10000 && e<20000) { int Vat=e-(e*3)/100; System.out.println("Salary 10000-19999 Deduct Vat 3% \t: " +Vat); } if(e<10000) { int Vat=e-(e*1)/100; System.out.println("Salary<10000 Deduct Vat 1% \t: " +Vat); } //for(int total=Vat); //total=Vat; //int sum=0 //for(int i=0;i<Vat.length;i++) //sum=sum+Vat; System.out.println("Total Salary \t\t: " +(e+f)); } }
เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง