小程序课程设计(小程序课程设计怎么做)
华为云服务器特价优惠火热进行中! 2核2G2兆仅需 38 元;4核4G3兆仅需 79 元。购买时间越长越优惠!更多配置及优惠价格请咨询客服。
合作流程: |
今天给各位分享小程序课程设计的知识,其中也会对小程序课程设计怎么做进行解释,如果能碰巧解决你现在面临的问题,别忘了关注本站,现在开始吧!
微信号:cloud7591如需了解更多,欢迎添加客服微信咨询。
复制微信号
本文目录一览:
- 1、!高分跪求帮忙写一个简单小程序的JAVA课程设计报告(内详!!)
- 2、java课程设计创意小游戏
- 3、我求一个C++小程序明天要交的课程设计!~~在线等待答案中 谢谢大家了
- 4、《C#程序设计》课程设计 利用 Visual Studio 2010 编一个小程序或小游戏,最后写成报告的形式,要求如下:
- 5、用C语言编写一个简单的图书管理小程序
!高分跪求帮忙写一个简单小程序的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; } //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 { k=1; }
}
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 { k=1; }
}
if (k==1) {
rowPassOne();
}
}
if (xi) {
for (j=x+1;j=i;j++ ) {
if (grid[j][y]!=0) {
k=0;
break;
}
else { k=1; }
}
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; } //K=2说明通过了第二次验证
}
}
if (y0j){ //第一按钮同行空按钮在与第二按钮之间
for (i=y0+1;i=j ;i++){
if (grid[x0][i]!=0) {
k=0;
break;
}
else{ k=2; }
}
}
}
public void rowPassOne(){
if (x0i) {
for (j=x0-1;j=i ;j-- ) {
if (grid[j][y0]!=0) {
k=0;
break;
}
else { k=2; }
}
}
if (x0i) {
for (j=x0+1;j=i ;j++ ) {
if (grid[j][y0]!=0) {
k=0;
break;
}
else { k=2; }
}
}
}
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课程设计—小游戏(含源代码)
//hi./srxboys/item/8ce4743da1adc991c2cf29c4
Tank——坦克大战(简洁版)源代码-------(此文档是自己在韩顺平教程总结而来)
*功能:1.防止敌人的坦克重叠运动
*(决定把判断是否碰撞的函数写到EnemyTank类)
*2.可以分关
*2.1(做一个开始的Panel,它是一个空的)
*2.2开始字体闪烁
*3.可以在玩游戏的时候,暂停和继续
*3.1当用户点击暂停时,子弹的速度和坦克速度设为0,并让坦克的方向
*不要发生变化。
*4.可以记录玩家的成绩
*4.1用文件流的方式(小游戏)[大游戏是用的数据库cs,bs结构,三国]
*4.2单写一个记录类,完成对玩家的记录
*4.3先完成保存共击毁了多少辆敌人坦克的功能
*4.4存盘退出游戏,可以记录当时的敌人的坦克坐标,并可以恢复
*5.java如何操作声音文件
*/
② JAVA课程设计,求个能用eclipse实现小游戏或小程序的源代码。感激不尽
你自己来去下自载吧,这里面都有 //oschina/project/java
③ 用JAVA编写一个小游戏
前天写的猜数字游戏,yongi控制猜测次数,有详细解析,用黑窗口可以直接运行,
我试验过了,没问题
import javax.swing.Icon;
import javax.swing.JOptionPane;
public class CaiShuZi4JOptionPane {
/**
* @param args
*/
public static void main(String[] args) {
Icon icon = null;
boolean bl = false;
int put = 0;
int c = (int) (((Math.random())*100)+1); //获取一个1-100的随机数
System.out.println("你获取的随机数是:"+c); //打印你的随机数字
String str1 = (String) JOptionPane.showInputDialog(null,"请输入你的猜测数字(1-100): ","猜数字游戏",JOptionPane.PLAIN_MESSAGE,icon,null,"在这输入"); //第一次输入你的猜测数字
if(str1==null){
JOptionPane.showMessageDialog(null, "你已经取消了本次游戏"); //如果你点取消那么本次游戏结束
}else{
bl = num(str1); //判断是输入的是不是数字或者是整数
if(true==bl){ //如果是数字的话进入与随机数比较的程序
System.out.println("你输入的数字是:"+str1); //打印你输入的数字
put = Integer.valueOf(str1);
for(int i = 4;i 0;i--){ //i是你可以猜测的次数
if(put==c){
JOptionPane.showMessageDialog(null, "恭喜你猜对了,正确答案是:"+c+"。"); //如果你猜对了就直接结束循环
break;
}else if(putc){ //如果输大了就让你再次从新输入
str1 = (String) JOptionPane.showInputDialog(null,"你的输入过大。你还有"+i+"次机会,请重新输入: ","猜数字游戏",JOptionPane.PLAIN_MESSAGE,icon,null,"在这输入");
if(str1==null){
JOptionPane.showMessageDialog(null, "你已经取消了本次输入");
break;
}else{
bl =num(str1);
if(true==bl){
put = Integer.valueOf(str1);
}else{
JOptionPane.showMessageDialog(null, "你的输入不正确,请重新输入");
}
}
}else if(putc){ //如果你输小了也让你从新输入
str1 = (String) JOptionPane.showInputDialog(null,"你的输入过小。你还有"+i+"次机会,请重新输入: ","猜数字游戏",JOptionPane.PLAIN_MESSAGE,icon,null,"在这输入");
if(str1==null){
JOptionPane.showMessageDialog(null, "你已经取消了本次输入");
break;
}else{
bl =num(str1);
if(true==bl){
put = Integer.valueOf(str1);
}else{
JOptionPane.showMessageDialog(null, "你的输入不正确,请重新输入");
}
}
}
}
}else if(bl==false){ //这个 是你第一次如果填写的不是数字的话也会结束本次游戏
JOptionPane.showMessageDialog(null, "请您下次按要求填写。本次游戏结束");
}
if(true==bl c!=put){ //如果你i次都没猜对,那么就直接告诉你这个数十什么
JOptionPane.showMessageDialog(null, "很遗憾你没能猜对,这个数字是:"+c+".");
}
}
}
public static boolean num(String value){ //一个静态方法,判断你输入的是不是数字
try {
Integer.parseInt(value);
return true;
} catch (Exception e) {
return false;
}
}
}
④ 用java制作一个小游戏 教学
static Scanner in =new Scanner(System.in);
public static int aaa(){
int c = 0;
while(true){
try {
if(c999c10000){
break;
}else{
// System.out.println("请输入4位整数");
c= in.nextInt();
if(c999c10000){
break;
}else{
System.out.println("输入有误,请重新输入4位整数");
}
}
} catch (Exception e) {
System.out.println("请输入整数");
c= in.nextInt();
}
}
//in.close();
return c;
}
public static void cai(){
//Scanner sa =new Scanner(System.in);
int haoma=(int)(Math.random()*10000);
if(haoma999)
{
haoma = Integer.parseInt(String.valueOf(haoma)+"0");
}
System.out.println(haoma);
System.out.println("请输入一位4位整数");
int aa = 0;
while(true){
aa= aaa();
String pd=String.valueOf(aa);
if(pd.length()!=4){
aa = aaa();
}else{
break;
}
}
while(true){
if(aa==haoma){
System.out.println("你猜对了,可以去买彩票了");
}else{
System.out.println("抱歉 , 你猜错了");
}
System.out.println("是否继续1继续 其他结束");
try {
int ss = in.nextInt();
if(ss==1){
cai();
}else{
break;
}
} catch (Exception e) {
in.close();
break;
}
}
}
public static void main(String[] args) {
System.out.println("欢迎来到猜号小游戏");
cai();
System.out.println("over");
}
⑤ 想做一个java小游戏 谁能给几个创意啊 注意 是创意!!!!! 不是已有的有创意的小游戏
比如有东西扔过来,选择吃掉或者躲开,考反应吧。
⑥ 急求java课程设计,内容可以是小游戏的,如(迷宫,计算器,停车场之恋的),要能运行,谢谢
俄罗斯方块,贪吃蛇。推箱子。
⑦ 求JAVA期末课程设计,要那种开发的小项目软件。可以是像记事本那种,也可以是小游戏那种。
网上搜不到的一般是不可共享的资源,建议去图书馆找本专门针对课程设计的书,里面的资料很丰富,你可以照着做一下,并作功能上适当的增减,这样网上就很难找到了

我求一个C++小程序明天要交的课程设计!~~在线等待答案中 谢谢大家了
本程序经过编译无误,仅供参考,其中使用了虚函数:
#includeiostream.h
class AUTO{
public:
AUTO()
{cout"This is a car class programming!"endl;
}
virtual void print()
{cout"This is a car class programming!"endl;}
};
class CAR:public AUTO{
public:
CAR()
{}
void print()
{cout"This is a car!"endl;}
};
class TRUCK:public AUTO{
public:
TRUCK()
{}
void print()
{cout"This is a truck!"endl;}
};
class BIKE:public AUTO{
public:
BIKE()
{}
void print()
{cout"This is a bike!"endl;}
};
int main()
{AUTO *p;
CAR a1;
TRUCK a2;
BIKE a3;
p=a1;
p-print();
p=a2;
p-print();
p=a3;
p-print();
return 0;
}
《C#程序设计》课程设计 利用 Visual Studio 2010 编一个小程序或小游戏,最后写成报告的形式,要求如下:
自己努力开发下吧,不会有人花时间免费给你开发的。
允许重复的话,去CSDN随便下一个就行
不过自己试着开发最好,这种东西看起来挺难,实际做起来也就那么回事
用C语言编写一个简单的图书管理小程序
源代码如下:
#includeiostream
#includeiomanip
#includestring
#includefstream
#includestdio.h
using namespace std;
const int maxb=10000; //最多的图书
class book//图书类
{
int tag; //删除标记1:已删0:未删
int number; //isbn书号
char name[20]; //书名
char author[10]; //主编
char number2[10];//版次
char position[20];//出版社
char time[20];//出版年
void addbook(int n,char *na,char *au,char *n2,char *da,char *ti,int pr) //增加图书
{
tag=0;
number=n;
price=pr;
strcpy(name,na);
strcpy(author,au);
strcpy(number2,n2);
strcpy(position,da);
strcpy(time,ti);
onshelf=1;
}
扩展资料
1、源程序中,很多符号都是成对匹配出现的,为避免遗漏必须配对使用的符号。
2、用花括号括起来的部分,但从程序结构清晰,便于阅读、理解、维护的角度出发,建议在书写程序时应遵循以下规则,以养成良好的编程习惯。
3、一个说明或一条语句占一行,与该结构开始处的左花括号对齐。
小程序课程设计的介绍就聊到这里吧,感谢你花时间阅读本站内容,更多关于小程序课程设计怎么做、小程序课程设计的信息别忘了在本站进行查找喔。
