Created
June 8, 2017 13:59
-
-
Save mikkipastel/35dc6422096651473daaa1762c24ff70 to your computer and use it in GitHub Desktop.
from my flash drive
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
INSERT INTO Players (playerno,pname,initials,Year_of_birthsex,year_jointed,town,leagueno) | |
VALUES (6,Paramenter,R,1964,M,1977,Stratford,8467); | |
CREATE TABLE Teams | |
( paymentno int, | |
pdate datetime, | |
amonut float, | |
PRIMARY KEY (paymentno) | |
) | |
SELECT pname | |
FROM Players P | |
WHERE p.sex=M; | |
SELECT * | |
FROM Players P | |
WHERE P.sex="M" and P.town="Stratford"; | |
SELECT P.pname,PN.amonut | |
FROM Players P,Penalties PN | |
WHERE P.playerno = PN.playerno and PN.amonut >50 | |
ORDER BY P.pname |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
** เวลา เซฟชื่อไฟลืต้องเซฟชื่อตามชื่อ class | |
********** | |
Dir >> รับข้อมูลทางคีย์บอร์ดโดยใช้ JOptionPane | |
import javax.swing.*; | |
class test | |
{ | |
public static void main(String[] args) | |
{ | |
double width,height,area; | |
String buf; | |
for(int i=0;i<5;i++){ | |
buf = JOptionPane.showInputDialog("width"); | |
width = Double.parseDouble(buf); | |
buf = JOptionPane.showInputDialog("height"); | |
height = Double.parseDouble(buf); | |
area=0.5*width*height; | |
System.out.println("Area = " +area); | |
} | |
} | |
} | |
*************** | |
Dir >> รับข้อมูลทางคีย์บอร์ดโดยใช้ scanner | |
import java.util.*; | |
class test | |
{ | |
public static void main(String[] args) | |
{ | |
double width,height,area; | |
String buf; | |
Scanner input = new Scanner(System.in); | |
for(int i=0;i<5;i++){ | |
System.out.print("Width = "); | |
width = input.nextDouble(); | |
System.out.print("height = "); | |
height = input.nextDouble(); | |
area=0.5*width*height; | |
System.out.println("Area = " +area); | |
} | |
} | |
} | |
*************** | |
Dir >> รับข้อมูลจาก file โดยที่ไฟล์ข้อมูลต้องอยุ่ใน ไดเรกทอรี่เดียวกับที่เซฟจาวา ไว้ | |
import java.util.*; | |
import java.io.*; | |
class test | |
{ | |
public static void main(String[] args) | |
{ | |
double width,height,area; | |
String buf; | |
try{ | |
Scanner input = new Scanner(new File("data.txt")); | |
while(input.hasNext()){ | |
width = input.nextDouble(); | |
height = input.nextDouble(); | |
area=0.5*width*height; | |
System.out.println("Area = " +area); | |
} | |
} | |
catch(Exception e){System.err.println(e);} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment