煙花代碼如下:
創(chuàng)新互聯(lián)公司服務(wù)項(xiàng)目包括大興網(wǎng)站建設(shè)、大興網(wǎng)站制作、大興網(wǎng)頁制作以及大興網(wǎng)絡(luò)營銷策劃等。多年來,我們專注于互聯(lián)網(wǎng)行業(yè),利用自身積累的技術(shù)優(yōu)勢(shì)、行業(yè)經(jīng)驗(yàn)、深度合作伙伴關(guān)系等,向廣大中小型企業(yè)、政府機(jī)構(gòu)等提供互聯(lián)網(wǎng)行業(yè)的解決方案,大興網(wǎng)站推廣取得了明顯的社會(huì)效益與經(jīng)濟(jì)效益。目前,我們服務(wù)的客戶以成都為中心已經(jīng)輻射到大興省份的部分城市,未來相信會(huì)繼續(xù)擴(kuò)大服務(wù)區(qū)域并繼續(xù)獲得客戶的支持與信任!
package love;
import java.applet.Applet;
import java.awt.Color;
import java.awt.Graphics;
import java.net.URL;
import java.util.Random;
/**
* 煙花
* @author enjoy
*
*/
@SuppressWarnings("serial")
public class Q extends Applet implements Runnable {
public int speed, variability, Max_Number, Max_Energy, Max_Patch,
Max_Length, G;
public String sound;
private int width, height;
private Thread thread = null;
private BeaClassDemo bcd[];
public void init() {
int i;
this.setSize(1900, 900);
width = getSize().width - 1;
height = getSize().height - 1;
speed = 1;??????????????????????? // 煙花綻放的速度
variability = 10;
Max_Number = 980;??????????????????? // 可發(fā)出煙花的最大數(shù)目
Max_Energy = width + 50;
Max_Patch = 90;??????????????????? // 最大的斑點(diǎn)數(shù)
Max_Length = 90;??????????????????? // 斑點(diǎn)的最大距離
G = 150;??????????????????????????? // 向地面彎曲的力度
bcd = new BeaClassDemo[Max_Number];
for (i = 0; i Max_Number; i++)
bcd[i] = new BeaClassDemo(width, height, G);
}
public void start() {
if (thread == null) {
thread = new Thread(this);
thread.start();
}
}
@SuppressWarnings("deprecation")
public void stop() {
if (thread != null) {
thread.stop();
thread = null;
}
}
@SuppressWarnings({ "unused", "static-access" })
public void run() {
int i;
int E = (int) (Math.random() * Max_Energy * 3 / 4) + Max_Energy / 4 + 1;
int P = (int) (Math.random() * Max_Patch * 3 / 4)??? // 煙花的斑點(diǎn)數(shù)
+ Max_Patch / 4 + 1;
int L = (int) (Math.random() * Max_Length * 3 / 4)??? // 煙花可發(fā)射出的距離
+ Max_Length / 4 + 1;
long S = (long) (Math.random() * 10000);
boolean sleep;
Graphics g = getGraphics();
URL u = null;
while (true) {
try {
thread.sleep(1000 / speed);
} catch (InterruptedException x) {
}
sleep = true;
for (i = 0; i Max_Number; i++)
sleep = sleep bcd[i].sleep;
if (sleep Math.random() * 100 variability) {
E = (int) (Math.random() * Max_Energy * 3 / 4) + Max_Energy / 4
+ 1;
P = (int) (Math.random() * Max_Patch * 3 / 4) + Max_Patch / 4
+ 1;
L = (int) (Math.random() * Max_Length * 3 / 4) + Max_Length / 4
+ 1;
S = (long) (Math.random() * 10000);
}
for (i = 0; i Max_Number; i++) {
if (bcd[i].sleep Math.random() * Max_Number * L 1) {
bcd[i].init(E, P, L, S);
bcd[i].start();
}
bcd[i].show(g);
}
}
}
public void paint(Graphics g) {
g.setColor(Color.black);
g.fillRect(0, 0, width + 1, height + 1);
}
}
class BeaClassDemo {
public boolean sleep = true;
private int energy, patch, length, width, height, G, Xx, Xy, Ex[], Ey[], x,
y, Red, Blue, Green, t;
private Random random;
public BeaClassDemo(int a, int b, int g) {
width = a;
height = b;
G = g;
}
public void init(int e, int p, int l, long seed) {
int i;
energy = e;
patch = p;
length = l;
// 創(chuàng)建一個(gè)帶種子的隨機(jī)數(shù)生成器
random = new Random(seed);
Ex = new int[patch];
Ey = new int[patch];
Red = (int) (random.nextDouble() * 128) + 128;
Blue = (int) (random.nextDouble() * 128) + 128;
Green = (int) (random.nextDouble() * 128) + 128;
Xx = (int) (Math.random() * width / 2) + width / 4;
Xy = (int) (Math.random() * height / 2) + height / 4;
for (i = 0; i patch; i++) {
Ex[i] = (int) (Math.random() * energy) - energy / 2;
Ey[i] = (int) (Math.random() * energy * 7 / 8) - energy / 8;
}
}
public void start() {
t = 0;
sleep = false;
}
public void show(Graphics g) {
if (!sleep)??????????????????
if (t length) {
int i, c;
double s;
Color color;
c = (int) (random.nextDouble() * 64) - 32 + Red;
if (c = 0 c 256)
Red = c;
c = (int) (random.nextDouble() * 64) - 32 + Blue;
if (c = 0 c 256)
Blue = c;
c = (int) (random.nextDouble() * 64) - 32 + Green;
if (c = 0 c 256)
Green = c;
color = new Color(Red, Blue, Green);
for (i = 0; i patch; i++) {
s = (double) t / 100;
x = (int) (Ex[i] * s);
y = (int) (Ey[i] * s - G * s * s);
g.setColor(color);
g.drawLine(Xx + x, Xy - y, Xx + x, Xy - y);
if (t = length / 2) {
int j;
for (j = 0; j 2; j++) {
s = (double) ((t - length / 2) * 2 + j) / 100;
x = (int) (Ex[i] * s);
y = (int) (Ey[i] * s - G * s * s);
g.setColor(Color.black);
g.drawLine(Xx + x, Xy - y, Xx + x, Xy - y);
}
}
}
t++;
} else {
sleep = true;
}
}
}
常用的編程語言。
編程語言一:C語言
C語言是世界上最流行、使用最廣泛的高級(jí)程序設(shè)計(jì)語言之一。在操作系統(tǒng)和系統(tǒng)使用程序以及需要對(duì)硬件進(jìn)行操作的場(chǎng)合,用C語言明顯優(yōu)于其它高級(jí)語言,許多大型應(yīng)用軟件都是用C語言編寫的。
編程語言二:java
Java是一種可以撰寫跨平臺(tái)應(yīng)用軟件的面向?qū)ο蟮某绦蛟O(shè)計(jì)語言,是由Sun Microsystems公司于1995年5月推出的Java程序設(shè)計(jì)語言和Java平臺(tái)(即JavaSE, JavaEE, JavaME)的總稱。
編程語言三:c++
C++這個(gè)詞在中國大陸的程序員圈子中通常被讀做“C加加”,而西方的程序員通常讀做“C plus plus" , "CPP”。 它是一種使用非常廣泛的計(jì)算機(jī)編程語言。C++是一種靜態(tài)數(shù)據(jù)類型檢查的、支持多重編程范式的通用程序設(shè)計(jì)語言。
你好,代碼如下:
package?com.test;
public?class?Test?{
public?static?void?main(String[]?args)?{
int[]?daysArg?=?{31,28,31,30,31,30,31,31,30,31,30,31};
for(int?i=0;idaysArg.length;i++){
System.out.println((i+1)?+?"月有"?+?daysArg[i]?+?"天");
}
}
}
上面 wuzhikun12同學(xué)寫的不錯(cuò),但我想還不能運(yùn)行,并且還不太完善。我給個(gè)能運(yùn)行的:(注意:文件名為:Test.java)
//要實(shí)現(xiàn)對(duì)象間的比較,就必須實(shí)現(xiàn)Comparable接口,它里面有個(gè)compareTo方法
//Comparable最好使用泛型,這樣,無論是速度還是代碼量都會(huì)減少
@SuppressWarnings("unchecked")
class Student implements ComparableStudent{
private String studentNo; //學(xué)號(hào)
private String studentName; //姓名
private double englishScore; //英語成績
private double computerScore; //計(jì)算機(jī)成績
private double mathScore; //數(shù)學(xué)成績
private double totalScore; //總成績
//空構(gòu)造函數(shù)
public Student() {}
//構(gòu)造函數(shù)
public Student(String studentNo,String studentName,double englishSocre,double computerScore,double mathScore) {
this.studentNo = studentNo;
this.studentName = studentName;
this.englishScore = englishSocre;
this.computerScore = computerScore;
this.mathScore = mathScore;
}
//計(jì)算總成績
public double sum() {
this.totalScore = englishScore+computerScore+mathScore;
return totalScore;
}
//計(jì)算評(píng)測(cè)成績
public double testScore() {
return sum()/3;
}
//實(shí)現(xiàn)compareTO方法
@Override
public int compareTo(Student student) {
double studentTotal = student.getTotalScore();
return totalScore==studentTotal?0:(totalScorestudentTotal?1:-1);
}
//重寫toString方法
public String toString(){
return "學(xué)號(hào):"+this.getStudentNo()+" 姓名:"+this.getStudentName()+" 英語成績:"+this.getEnglishScore()+" 數(shù)學(xué)成績:"+this.getMathScore()+" 計(jì)算機(jī)成績:"+this.getComputerScore()+" 總成績:"+this.getTotalScore();
}
//重寫equals方法
public boolean equals(Object obj) {
if(obj == null){
return false;
}
if(!(obj instanceof Student)){
return false;
}
Student student = (Student)obj;
if(this.studentNo.equals(student.getStudentName())) { //照現(xiàn)實(shí)來說,比較是不是同一個(gè)學(xué)生,應(yīng)該只是看他的學(xué)號(hào)是不是相同
return true;
} else {
return false;
}
}
/*以下為get和set方法,我個(gè)人認(rèn)為,totalScore的set的方法沒必要要,因?yàn)樗怯善渌煽冇?jì)算出來的
在set方法中,沒設(shè)置一次值,調(diào)用一次sum方法,即重新計(jì)算總成績
*/
public String getStudentNo() {
return studentNo;
}
public void setStudentNo(String studentNo) {
this.studentNo = studentNo;
sum();
}
public String getStudentName() {
return studentName;
}
public void setStudentName(String studentName) {
this.studentName = studentName;
sum();
}
public double getEnglishScore() {
return englishScore;
}
public void setEnglishScore(double englishScore) {
this.englishScore = englishScore;
sum();
}
public double getComputerScore() {
return computerScore;
}
public void setComputerScore(double computerScore) {
this.computerScore = computerScore;
sum();
}
public double getMathScore() {
return mathScore;
}
public void setMathScore(double mathScore) {
this.mathScore = mathScore;
sum();
}
public double getTotalScore() {
return totalScore;
}
}
//Student子類學(xué)習(xí)委員類的實(shí)現(xiàn)
class StudentXW extends Student {
//重寫父類Student的testScore()方法
@Override
public double testScore() {
return sum()/3+3;
}
public StudentXW() {}
//StudentXW的構(gòu)造函數(shù)
public StudentXW(String studentNo,String studentName,double englishSocre,double computerScore,double mathScore) {
super(studentNo,studentName,englishSocre,computerScore,mathScore);
}
}
//Student子類班長類的實(shí)現(xiàn)
class StudentBZ extends Student {
//重寫父類Student的testScore()方法
@Override
public double testScore() {
return sum()/3+5;
}
public StudentBZ() {}
//StudentXW的構(gòu)造函數(shù)
public StudentBZ(String studentNo,String studentName,double englishSocre,double computerScore,double mathScore) {
super(studentNo,studentName,englishSocre,computerScore,mathScore);
}
}
//測(cè)試類
public class Test {
public static void main(String[] args) {
//生成若干個(gè)student類、StudentXW類、StudentBZ類
Student student1 = new Student("s001","張三",70.5,50,88.5);
Student student2 = new Student("s002","李四",88,65,88.5);
Student student3 = new Student("s003","王五",67,77,90);
StudentXW student4 = new StudentXW("s004","李六",99,88,99.5);
StudentBZ student5 = new StudentBZ("s005","朱漆",56,65.6,43.5);
Student[] students = {student1,student2,student3,student4,student5};
for(int i = 0 ; istudents.length; i++){
double avgScore = students[i].testScore();
System.out.println(students[i].getStudentName()+"學(xué)生的評(píng)測(cè)成績?yōu)椋?+ avgScore+"分");
}
}
}
運(yùn)行結(jié)果為:
張三學(xué)生的評(píng)測(cè)成績?yōu)椋?9.66666666666667分
李四學(xué)生的評(píng)測(cè)成績?yōu)椋?0.5分
王五學(xué)生的評(píng)測(cè)成績?yōu)椋?8.0分
李六學(xué)生的評(píng)測(cè)成績?yōu)椋?8.5分
朱漆學(xué)生的評(píng)測(cè)成績?yōu)椋?0.03333333333333分
數(shù)據(jù)庫是按照數(shù)據(jù)結(jié)構(gòu)來組織、存儲(chǔ)和管理數(shù)據(jù)的倉庫,數(shù)據(jù)管理不再僅僅是存儲(chǔ)和管理數(shù)據(jù),而轉(zhuǎn)變成用戶所需要的各種數(shù)據(jù)管理的方式。數(shù)據(jù)庫有很多種類型,從最簡單的存儲(chǔ)有各種數(shù)據(jù)的表格到能夠進(jìn)行海量數(shù)據(jù)存儲(chǔ)的大型數(shù)據(jù)庫系統(tǒng)都在各個(gè)方面得到了廣泛的應(yīng)用。在信息化社會(huì),充分有效地管理和利用各類信息資源,是進(jìn)行科學(xué)研究和決策管理的前提條件。數(shù)據(jù)庫技術(shù)是管理信息系統(tǒng)、辦公自動(dòng)化系統(tǒng)、決策支持系統(tǒng)等各類信息系統(tǒng)的核心部分,是進(jìn)行科學(xué)研究和決策管理的重要技術(shù)手段。數(shù)據(jù)庫是一個(gè)單位或是一個(gè)應(yīng)用領(lǐng)域的通用數(shù)據(jù)處理系統(tǒng),它存儲(chǔ)的是屬于企業(yè)和事業(yè)部門、團(tuán)體和個(gè)人的有關(guān)數(shù)據(jù)的集合。數(shù)據(jù)庫中的數(shù)據(jù)是從全局觀點(diǎn)出發(fā)建立的,按一定的數(shù)據(jù)模型進(jìn)行組織、描述和存儲(chǔ)。其結(jié)構(gòu)基于數(shù)據(jù)間的自然聯(lián)系,從而可提供一切必要的存取路徑,且數(shù)據(jù)不再針對(duì)某一應(yīng)用,而是面向全組織,具有整體的結(jié)構(gòu)化特征。數(shù)據(jù)庫中的數(shù)據(jù)是為眾多用戶所共享其信息而建立的,已經(jīng)擺脫了具體程序的限制和制約。不同的用戶可以按各自的用法使用數(shù)據(jù)庫中的數(shù)據(jù);多個(gè)用戶可以同時(shí)共享數(shù)據(jù)庫中的數(shù)據(jù)資源,即不同的用戶可以同時(shí)存取數(shù)據(jù)庫中的同一個(gè)數(shù)據(jù)。數(shù)據(jù)共享性不僅滿足了各用戶對(duì)信息內(nèi)容的要求,同時(shí)也滿足了各用戶之間信息通信的要求。
連連看java源代碼
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class lianliankan implements ActionListener
{
JFrame mainFrame; //主面板
Container thisContainer;
JPanel centerPanel,southPanel,northPanel; //子面板
JButton diamondsButton[][] = new JButton[6][5];//游戲按鈕數(shù)組
JButton exitButton,resetButton,newlyButton; //退出,重列,重新開始按鈕
JLabel fractionLable=new JLabel("0"); //分?jǐn)?shù)標(biāo)簽
JButton firstButton,secondButton; //分別記錄兩次被選中的按鈕
int grid[][] = new int[8][7];//儲(chǔ)存游戲按鈕位置
static boolean pressInformation=false; //判斷是否有按鈕被選中
int x0=0,y0=0,x=0,y=0,fristMsg=0,secondMsg=0,validateLV; //游戲按鈕的位置坐標(biāo)
int i,j,k,n;//消除方法控制
public void init(){
mainFrame=new JFrame("JKJ連連看");
thisContainer = mainFrame.getContentPane();
thisContainer.setLayout(new BorderLayout());
centerPanel=new JPanel();
southPanel=new JPanel();
northPanel=new JPanel();
thisContainer.add(centerPanel,"Center");
thisContainer.add(southPanel,"South");
thisContainer.add(northPanel,"North");
centerPanel.setLayout(new GridLayout(6,5));
for(int cols = 0;cols 6;cols++){
for(int rows = 0;rows 5;rows++ ){
diamondsButton[cols][rows]=new JButton(String.valueOf(grid[cols+1][rows+1]));
diamondsButton[cols][rows].addActionListener(this);
centerPanel.add(diamondsButton[cols][rows]);
}
}
exitButton=new JButton("退出");
exitButton.addActionListener(this);
resetButton=new JButton("重列");
resetButton.addActionListener(this);
newlyButton=new JButton("再來一局");
newlyButton.addActionListener(this);
southPanel.add(exitButton);
southPanel.add(resetButton);
southPanel.add(newlyButton);
fractionLable.setText(String.valueOf(Integer.parseInt(fractionLable.getText())));
northPanel.add(fractionLable);
mainFrame.setBounds(280,100,500,450);
mainFrame.setVisible(true);
}
public void randomBuild() {
int randoms,cols,rows;
for(int twins=1;twins=15;twins++) {
randoms=(int)(Math.random()*25+1);
for(int alike=1;alike=2;alike++) {
cols=(int)(Math.random()*6+1);
rows=(int)(Math.random()*5+1);
while(grid[cols][rows]!=0) {
cols=(int)(Math.random()*6+1);
rows=(int)(Math.random()*5+1);
}
this.grid[cols][rows]=randoms;
}
}
}
public void fraction(){
fractionLable.setText(String.valueOf(Integer.parseInt(fractionLable.getText())+100));
}
public void reload() {
int save[] = new int[30];
int n=0,cols,rows;
int grid[][]= new int[8][7];
for(int i=0;i=6;i++) {
for(int j=0;j=5;j++) {
if(this.grid[i][j]!=0) {
save[n]=this.grid[i][j];
n++;
}
}
}
n=n-1;
this.grid=grid;
while(n=0) {
cols=(int)(Math.random()*6+1);
rows=(int)(Math.random()*5+1);
while(grid[cols][rows]!=0) {
cols=(int)(Math.random()*6+1);
rows=(int)(Math.random()*5+1);
}
this.grid[cols][rows]=save[n];
n--;
}
mainFrame.setVisible(false);
pressInformation=false; //這里一定要將按鈕點(diǎn)擊信息歸為初始
init();
for(int i = 0;i 6;i++){
for(int j = 0;j 5;j++ ){
if(grid[i+1][j+1]==0)
diamondsButton[i][j].setVisible(false);
}
}
}
public void estimateEven(int placeX,int placeY,JButton bz) {
if(pressInformation==false) {
x=placeX;
y=placeY;
secondMsg=grid[x][y];
secondButton=bz;
pressInformation=true;
}
else {
x0=x;
y0=y;
fristMsg=secondMsg;
firstButton=secondButton;
x=placeX;
y=placeY;
secondMsg=grid[x][y];
secondButton=bz;
if(fristMsg==secondMsg secondButton!=firstButton){
xiao();
}
}
}
public void xiao() { //相同的情況下能不能消去。仔細(xì)分析,不一條條注釋
if((x0==x (y0==y+1||y0==y-1)) || ((x0==x+1||x0==x-1)(y0==y))){ //判斷是否相鄰
remove();
}
else{
for (j=0;j7;j++ ) {
if (grid[x0][j]==0){ //判斷第一個(gè)按鈕同行哪個(gè)按鈕為空
if (yj) { //如果第二個(gè)按鈕的Y坐標(biāo)大于空按鈕的Y坐標(biāo)說明第一按鈕在第二按鈕左邊
for (i=y-1;i=j;i-- ){ //判斷第二按鈕左側(cè)直到第一按鈕中間有沒有按鈕
if (grid[x][i]!=0) {
k=0;
break;
}
else //K=1說明通過了第一次驗(yàn)證
}
if (k==1) {
linePassOne();
}
}
if (yj){ //如果第二個(gè)按鈕的Y坐標(biāo)小于空按鈕的Y坐標(biāo)說明第一按鈕在第二按鈕右邊
for (i=y+1;i=j ;i++ ){ //判斷第二按鈕左側(cè)直到第一按鈕中間有沒有按鈕
if (grid[x][i]!=0){
k=0;
break;
}
else
}
if (k==1){
linePassOne();
}
}
if (y==j ) {
linePassOne();
}
}
if (k==2) {
if (x0==x) {
remove();
}
if (x0x) {
for (n=x0;n=x-1;n++ ) {
if (grid[n][j]!=0) {
k=0;
break;
}
if(grid[n][j]==0 n==x-1) {
remove();
}
}
}
if (x0x) {
for (n=x0;n=x+1 ;n-- ) {
if (grid[n][j]!=0) {
k=0;
break;
}
if(grid[n][j]==0 n==x+1) {
remove();
}
}
}
}
}
for (i=0;i8;i++ ) { //列
if (grid[i][y0]==0) {
if (xi) {
for (j=x-1;j=i ;j-- ) {
if (grid[j][y]!=0) {
k=0;
break;
}
else
}
if (k==1) {
rowPassOne();
}
}
if (xi) {
for (j=x+1;j=i;j++ ) {
if (grid[j][y]!=0) {
k=0;
break;
}
else
}
if (k==1) {
rowPassOne();
}
}
if (x==i) {
rowPassOne();
}
}
if (k==2){
if (y0==y) {
remove();
}
if (y0y) {
for (n=y0;n=y-1 ;n++ ) {
if (grid[i][n]!=0) {
k=0;
break;
}
if(grid[i][n]==0 n==y-1) {
remove();
}
}
}
if (y0y) {
for (n=y0;n=y+1 ;n--) {
if (grid[i][n]!=0) {
k=0;
break;
}
if(grid[i][n]==0 n==y+1) {
remove();
}
}
}
}
}
}
}
public void linePassOne(){
if (y0j){ //第一按鈕同行空按鈕在左邊
for (i=y0-1;i=j ;i-- ){ //判斷第一按鈕同左側(cè)空按鈕之間有沒按鈕
if (grid[x0][i]!=0) {
k=0;
break;
}
else //K=2說明通過了第二次驗(yàn)證
}
}
if (y0j){ //第一按鈕同行空按鈕在與第二按鈕之間
for (i=y0+1;i=j ;i++){
if (grid[x0][i]!=0) {
k=0;
break;
}
else
}
}
}
public void rowPassOne(){
if (x0i) {
for (j=x0-1;j=i ;j-- ) {
if (grid[j][y0]!=0) {
k=0;
break;
}
else
}
}
if (x0i) {
for (j=x0+1;j=i ;j++ ) {
if (grid[j][y0]!=0) {
k=0;
break;
}
else
}
}
}
public void remove(){
firstButton.setVisible(false);
secondButton.setVisible(false);
fraction();
pressInformation=false;
k=0;
grid[x0][y0]=0;
grid[x][y]=0;
}
public void actionPerformed(ActionEvent e) {
if(e.getSource()==newlyButton){
int grid[][] = new int[8][7];
this.grid = grid;
randomBuild();
mainFrame.setVisible(false);
pressInformation=false;
init();
}
if(e.getSource()==exitButton)
System.exit(0);
if(e.getSource()==resetButton)
reload();
for(int cols = 0;cols 6;cols++){
for(int rows = 0;rows 5;rows++ ){
if(e.getSource()==diamondsButton[cols][rows])
estimateEven(cols+1,rows+1,diamondsButton[cols][rows]);
}
}
}
public static void main(String[] args) {
lianliankan llk = new lianliankan();
llk.randomBuild();
llk.init();
}
}
//old 998 lines
//new 318 lines