重庆分公司,新征程启航

为企业提供网站建设、域名注册、服务器等服务

java跨年代码素材 java飞机大战代码及素材

2022年跨年烟花代码

烟花代码如下:

创新互联公司服务项目包括大兴网站建设、大兴网站制作、大兴网页制作以及大兴网络营销策划等。多年来,我们专注于互联网行业,利用自身积累的技术优势、行业经验、深度合作伙伴关系等,向广大中小型企业、政府机构等提供互联网行业的解决方案,大兴网站推广取得了明显的社会效益与经济效益。目前,我们服务的客户以成都为中心已经辐射到大兴省份的部分城市,未来相信会继续扩大服务区域并继续获得客户的支持与信任!

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;                    // 可发出烟花的最大数目

Max_Energy = width + 50;

Max_Patch = 90;                    // 最大的斑点数

Max_Length = 90;                    // 斑点的最大距离

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)    // 烟花的斑点数

+ Max_Patch / 4 + 1;

int L = (int) (Math.random() * Max_Length * 3 / 4)    // 烟花可发射出的距离

+ 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;

// 创建一个带种子的随机数生成器

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语言是世界上最流行、使用最广泛的高级程序设计语言之一。在操作系统和系统使用程序以及需要对硬件进行操作的场合,用C语言明显优于其它高级语言,许多大型应用软件都是用C语言编写的。

编程语言二:java

Java是一种可以撰写跨平台应用软件的面向对象的程序设计语言,是由Sun Microsystems公司于1995年5月推出的Java程序设计语言和Java平台(即JavaSE, JavaEE, JavaME)的总称。

编程语言三:c++

C++这个词在中国大陆的程序员圈子中通常被读做“C加加”,而西方的程序员通常读做“C plus plus" , "CPP”。 它是一种使用非常广泛的计算机编程语言。C++是一种静态数据类型检查的、支持多重编程范式的通用程序设计语言。

JAVA编写源代码,要求使用数组存储一年12个月份的天数,并按顺序输入

你好,代码如下:

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] + "天");

}

}

}

高分求两个简单的JAVA设计源代码

上面 wuzhikun12同学写的不错,但我想还不能运行,并且还不太完善。我给个能运行的:(注意:文件名为:Test.java)

//要实现对象间的比较,就必须实现Comparable接口,它里面有个compareTo方法

//Comparable最好使用泛型,这样,无论是速度还是代码量都会减少

@SuppressWarnings("unchecked")

class Student implements ComparableStudent{

private String studentNo; //学号

private String studentName; //姓名

private double englishScore; //英语成绩

private double computerScore; //计算机成绩

private double mathScore; //数学成绩

private double totalScore; //总成绩

//空构造函数

public Student() {}

//构造函数

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;

}

//计算总成绩

public double sum() {

this.totalScore = englishScore+computerScore+mathScore;

return totalScore;

}

//计算评测成绩

public double testScore() {

return sum()/3;

}

//实现compareTO方法

@Override

public int compareTo(Student student) {

double studentTotal = student.getTotalScore();

return totalScore==studentTotal?0:(totalScorestudentTotal?1:-1);

}

//重写toString方法

public String toString(){

return "学号:"+this.getStudentNo()+" 姓名:"+this.getStudentName()+" 英语成绩:"+this.getEnglishScore()+" 数学成绩:"+this.getMathScore()+" 计算机成绩:"+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())) { //照现实来说,比较是不是同一个学生,应该只是看他的学号是不是相同

return true;

} else {

return false;

}

}

/*以下为get和set方法,我个人认为,totalScore的set的方法没必要要,因为它是由其它成绩计算出来的

在set方法中,没设置一次值,调用一次sum方法,即重新计算总成绩

*/

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子类学习委员类的实现

class StudentXW extends Student {

//重写父类Student的testScore()方法

@Override

public double testScore() {

return sum()/3+3;

}

public StudentXW() {}

//StudentXW的构造函数

public StudentXW(String studentNo,String studentName,double englishSocre,double computerScore,double mathScore) {

super(studentNo,studentName,englishSocre,computerScore,mathScore);

}

}

//Student子类班长类的实现

class StudentBZ extends Student {

//重写父类Student的testScore()方法

@Override

public double testScore() {

return sum()/3+5;

}

public StudentBZ() {}

//StudentXW的构造函数

public StudentBZ(String studentNo,String studentName,double englishSocre,double computerScore,double mathScore) {

super(studentNo,studentName,englishSocre,computerScore,mathScore);

}

}

//测试类

public class Test {

public static void main(String[] args) {

//生成若干个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()+"学生的评测成绩为:"+ avgScore+"分");

}

}

}

运行结果为:

张三学生的评测成绩为:69.66666666666667分

李四学生的评测成绩为:80.5分

王五学生的评测成绩为:78.0分

李六学生的评测成绩为:98.5分

朱漆学生的评测成绩为:60.03333333333333分

求韩顺平老师Java满汉楼源码,素材及数据库

数据库是按照数据结构来组织、存储和管理数据的仓库,数据管理不再仅仅是存储和管理数据,而转变成用户所需要的各种数据管理的方式。数据库有很多种类型,从最简单的存储有各种数据的表格到能够进行海量数据存储的大型数据库系统都在各个方面得到了广泛的应用。在信息化社会,充分有效地管理和利用各类信息资源,是进行科学研究和决策管理的前提条件。数据库技术是管理信息系统、办公自动化系统、决策支持系统等各类信息系统的核心部分,是进行科学研究和决策管理的重要技术手段。数据库是一个单位或是一个应用领域的通用数据处理系统,它存储的是属于企业和事业部门、团体和个人的有关数据的集合。数据库中的数据是从全局观点出发建立的,按一定的数据模型进行组织、描述和存储。其结构基于数据间的自然联系,从而可提供一切必要的存取路径,且数据不再针对某一应用,而是面向全组织,具有整体的结构化特征。数据库中的数据是为众多用户所共享其信息而建立的,已经摆脱了具体程序的限制和制约。不同的用户可以按各自的用法使用数据库中的数据;多个用户可以同时共享数据库中的数据资源,即不同的用户可以同时存取数据库中的同一个数据。数据共享性不仅满足了各用户对信息内容的要求,同时也满足了各用户之间信息通信的要求。

JAVA代码

连连看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];//游戏按钮数组

JButton exitButton,resetButton,newlyButton; //退出,重列,重新开始按钮

JLabel fractionLable=new JLabel("0"); //分数标签

JButton firstButton,secondButton; //分别记录两次被选中的按钮

int grid[][] = new int[8][7];//储存游戏按钮位置

static boolean pressInformation=false; //判断是否有按钮被选中

int x0=0,y0=0,x=0,y=0,fristMsg=0,secondMsg=0,validateLV; //游戏按钮的位置坐标

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; //这里一定要将按钮点击信息归为初始

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() { //相同的情况下能不能消去。仔细分析,不一条条注释

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){ //判断第一个按钮同行哪个按钮为空

if (yj) { //如果第二个按钮的Y坐标大于空按钮的Y坐标说明第一按钮在第二按钮左边

for (i=y-1;i=j;i-- ){ //判断第二按钮左侧直到第一按钮中间有没有按钮

if (grid[x][i]!=0) {

k=0;

break;

}

else //K=1说明通过了第一次验证

}

if (k==1) {

linePassOne();

}

}

if (yj){ //如果第二个按钮的Y坐标小于空按钮的Y坐标说明第一按钮在第二按钮右边

for (i=y+1;i=j ;i++ ){ //判断第二按钮左侧直到第一按钮中间有没有按钮

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-- ){ //判断第一按钮同左侧空按钮之间有没按钮

if (grid[x0][i]!=0) {

k=0;

break;

}

else //K=2说明通过了第二次验证

}

}

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


网页名称:java跨年代码素材 java飞机大战代码及素材
URL网址:http://cqcxhl.com/article/dodjspj.html

其他资讯

在线咨询
服务热线
服务热线:028-86922220
TOP