关于java练手项目大概有以下多种
1、BBS论坛系统(jsp+sql)
2、ERP管理系统(jsp+servlet)
3、OA办公自动化管理系统(Struts1.2+Hibernate3.0+Spring2+DWR)
4、博客系统(struts+hibernate+spring)
5、车辆管理系统(struts+hibernate+spring+oracle)
6、家庭理财系统(java+applet)
7、教材订购系统(jsp+servlet+mysql)
8、酒店管理系统(jsp+servlet+mysql)
9、乐趣大型购物系统 v1.1(jsp+servlet+mysql)
10、聊天系统(java+applet)
11、内容管理系统(hibernate3+struts2+spring2)
12、图书管理系统(struts+hibernate+spring)
13、网上订餐系统(struts+spring+hibernate)
14、网上书城系统(Struts+Hibernate+Mysql)
15、网上书店系统(论文+jsp源程序)
16、项目申报系统(Struts2+Spring+Hibernate+Jsp+Mysql5)
17、学生成绩管理系统(SSH+MYSQL)
18、阳光酒店管理系统(javaapplet+SQL)
19、移动ssh项目(struts+spring+hibernate+oracle)
20、音乐网站(JSP+SERVLET)
/*** 文件名:Operation.java 2014-1-2 下午3:06:37
* @author Administrator
*/
package cc.icoc.javaxu.action
import java.util.ArrayList
import java.util.Scanner
import cc.icoc.javaxu.datas.StudentInfo
/**
* @author 许仕永
* 创建时间: 2014 2014-1-2 下午3:06:37
*/
public class Operation
{
int stuNo,stuAge
String stuName,stuClass,stuSex
ArrayList<StudentInfo>list
/**程序入口
* @param args
*/
public static void main(String[] args)
{
// TODO Auto-generated method stub
new Operation().operation()
}
private int inputInt()
{
Scanner scanner = new Scanner(System.in)
return scanner.nextInt()
}
private String inputStr()
{
Scanner scanner = new Scanner(System.in)
return scanner.nextLine()
}
private void operation()
{
// TODO Auto-generated method stub
if(list == null)
{
list = new ArrayList<StudentInfo>()
}
while(true)
{
System.out.println("\t\t\t学生信息管理系统\n")
System.out.println("1.信息查阅")
System.out.println("2.信息查询")
System.out.println("3.信息录入")
System.out.println("4.退出系统")
int what = inputInt()
if ( what == 1 )
{
getInfo()
} else if ( what == 2 )
{
allSerach()
} else if ( what == 3 )
{
inputInfo()
} else if( what == 4 )
{
System.out.println("已经退出系统")
System.exit(0)
}
}
}
/**
* 获取全部学生的信息列表
*/
private void getInfo()
{
if(!list.isEmpty())
{
for ( int i = 0i <list.size()i++ )
{
System.out.println(list.get(i))
}
}
}
/**
* 执行查找
*/
private void allSerach()
{
System.out.println("1.输入学号进行查询")
System.out.println("2.输入姓名进行查询")
int what = inputInt()
if(what == 1)
{
System.out.println("请输入学号:")
search(inputInt())
}
else
{
System.out.println("请输入姓名:")
search(inputStr())
}
}
/**
* 按学生姓名查询学生信息
* @param name 学生姓名
*/
private StudentInfo search(String name)
{
for ( int i = 0i <list.size()i++ )
{
if(list.get(i).getStuName().equals(name))
{
System.out.println(list.get(i))
return list.get(i)
}
}
System.out.println("未查询到该名字的学生")
return null
}
/**
* 按学号查询学生信息
* @param id 学号
*/
private StudentInfo search(int id)
{
for ( int i = 0i <list.size()i++ )
{
if(list.get(i).getStuNo()==id)
{
System.out.println(list.get(i))
return list.get(i)
}
}
System.out.println("未查询到该学号的学生")
return null
}
/**
* 录入学生信息
*/
private void inputInfo()
{
try
{
System.out.print("请输入学生学号:\n")
stuNo = inputInt()
System.out.print("请输入学生姓名:\n")
stuName = inputStr()
System.out.print("请输入学生性别:\n")
stuSex = inputStr()
System.out.print("请输入学生年龄:\n")
stuAge = inputInt()
System.out.print("请输入学生班级:\n")
stuClass = inputStr()
list.add(new StudentInfo(stuNo, stuAge, stuName, stuSex, stuClass))
} catch (Exception e)
{
// TODO: handle exception
System.out.println("不允许为空,请重新输入")
}
}
}
package cc.icoc.javaxu.action
import java.util.ArrayList
import java.util.List
import java.util.Scanner
public class Stu
{
int countStu = 0
int sum = 0
int avg = 0
List<StuBean>list = new ArrayList<Stu.StuBean>()
public static void main(String[] args)
{
new Stu().go()
}
private void go()
{
A:while(true)
{
//构造实体Bean来存储学生成绩
StuBean bean = new StuBean()
System.out.println("请输入成绩:")
System.out.println("语文:")
bean.setYuwen(scanner())
System.out.println("数学:")
bean.setMath(scanner())
//获取英语成绩
System.out.println("英语:")
bean.setEnglish(scanner())
//存入容器
list.add(bean)
for ( int i = 0i <list.size()i++ )
{
sum += list.get(i).english+list.get(i).math+list.get(i).yuwen
}
avg = sum / (3*list.size())
System.out.println("当前有"+list.size()+"条学生记录,所有学生总分="+sum+"平均分为"+avg)
//输入y继续录入学生信息,输入x退出
System.out.println("\n已成功录入一个学生的数据,是否继续/退出(y/x)")
if("x".equals(scannerString()))
break A
}
}
/**输入*/
private int scanner()
{
Scanner scanner = new Scanner(System.in)
return scanner.nextInt()
}
/**输入*/
private String scannerString()
{
Scanner scanner = new Scanner(System.in)
return scanner.nextLine()
}
class StuBean
{
int math
int yuwen
int english
public int getMath()
{
return math
}
public void setMath(int math)
{
this.math = math
}
public int getYuwen()
{
return yuwen
}
public void setYuwen(int yuwen)
{
this.yuwen = yuwen
}
public int getEnglish()
{
return english
}
public void setEnglish(int english)
{
this.english = english
}
}
}
/**
* 文件名:StudentInfo.java 2014-1-2 下午3:07:29
* @author Administrator
*/
package cc.icoc.javaxu.datas
/**
* @author 许仕永
* 创建时间: 2014 2014-1-2 下午3:07:29
*/
public class StudentInfo
{
int stuNo,stuAge
String stuName,stuSex,stuClass
public StudentInfo(int stuNo, int stuAge, String stuName, String stuSex, String stuClass)
{
super()
this.stuNo = stuNo
this.stuAge = stuAge
this.stuName = stuName
this.stuSex = stuSex
this.stuClass = stuClass
}
public int getStuNo()
{
return stuNo
}
public void setStuNo(int stuNo)
{
this.stuNo = stuNo
}
public int getStuAge()
{
return stuAge
}
public void setStuAge(int stuAge)
{
this.stuAge = stuAge
}
public String getStuName()
{
return stuName
}
public void setStuName(String stuName)
{
this.stuName = stuName
}
public String getStuSex()
{
return stuSex
}
public void setStuSex(String stuSex)
{
this.stuSex = stuSex
}
public String getStuClass()
{
return stuClass
}
public void setStuClass(String stuClass)
{
this.stuClass = stuClass
}
@Override
public String toString()
{
// TODO Auto-generated method stub
String s = "学号:"+getStuNo()+"\t姓名:"+getStuName()+" \t性别:"+getStuSex()+"\t年龄:"+getStuAge()+"\t班级:"+getStuClass()
return s
}
}
控制台小游戏 class YZDEL{
public static void main(String[] args)
{
java.util.Random Shiji = new java.util.Random()
java.util.Scanner Shuru = new java.util.Scanner(System.in)
java.util.Scanner Nandu = new java.util.Scanner(System.in)
int YingxHP = 20
int YingxMP = 0
int MogHP = 20
int MogMP = 0
int MogDo = 0
int fangyu = 0
System.out.println("┏━━━━╮┏━━┣┣┓ ╮ ┓┏━┳━┳┓┓━┓ ")
System.out.println("┏┣━━━┓┏━━┣┣┓ ┃┏ ┃ ┃┓┃ ╯ ")
System.out.println("┣┣━━━┫╭━━┻╯╮ ┃╰┓┃ ┃╯┏━┣━━┓")
System.out.println("┣┣━━━┫┏━━━━┓╭━━┣━┛┗━┻━┻┛┃┃")
System.out.println("┏┣━━━┓┣━━━━┫ ┃┃┃┗╮╮┃┃┣━╯")
System.out.println(" ┛┗╯┗━━━━╯┗╯╰╰━━┛┛┗━╯╰━┛")
System.out.println()
System.out.println(" 作者:天狐空幻")
System.out.println()
System.out.println("说明:勇者的 *** 作方式为以下所示:")
System.out.println(" 使用攻击需消耗1MP 伤害1HP")
System.out.println(" 使用蓄力可增加1MP 伤害0HP")
System.out.println(" 使用躲闪需消耗0MP 伤害0HP 躲避攻击")
System.out.println(" 使用重击需消耗3MP 伤害2HP 防御无效")
System.out.println(" 恶龙攻击力高, 注意防御是取胜的关键")
System.out.println(" 恶龙MP达到4时可能会放出火焰无法躲避")
System.out.println(" 准备说明完毕,那么让我们来挑战恶龙吧!")
System.out.println("==================================")
//难度选择
System.out.println("请选择难度")
System.out.println("1.娱乐 2.挑战 3.噩梦")
int ND = Nandu.nextInt()
System.out.println("==================================")
while(true)
{
//HP,MP的显示
System.out.print("勇者: ")
System.out.print(" HP ")
for(int x=YingxHPx>0x--) System.out.print("*")
System.out.print(" "+YingxHP)
System.out.println()
System.out.print(" ")
System.out.print(" MP ")
for(int x=YingxMPx>0x--) System.out.print("*")
System.out.print(" "+YingxMP)
System.out.println()
System.out.print("恶龙: ")
System.out.print(" HP ")
for(int y=MogHPy>0y--) System.out.print("*")
System.out.print(" "+MogHP)
System.out.println()
System.out.print(" ")
System.out.print(" MP ")
for(int y=MogMPy>0y--) System.out.print("*")
System.out.print(" "+MogMP)
System.out.println()
System.out.println("==================================")
//胜利判定
if(YingxHP<1) {System.out.println()System.out.println("勇者HP为0! 不..不可能..我怎么会..勇者倒下了。再接再厉吧!~")System.out.println()break}
if(MogHP<1) {System.out.println()System.out.println("恶龙HP为0! 恶龙绝望的哀鸣中倒了下去。勇者胜利了。恭喜你挑战成功!!")System.out.println()break}
//角色输入判定
System.out.println("你要做什么:")
System.out.println("1.攻击 2.蓄力")
System.out.println("3.躲闪 4.重击")
System.out.println("____________________")
int Do = Shuru.nextInt()
//敌人输入判定
//娱乐难度
if(ND==1){
for(int i=1i<3i++) MogDo = Shiji.nextInt(4)}
//挑战难度
if(ND==2){
if(YingxMP==0&&MogMP==0) {MogDo = 0}
else if(MogMP==0){for(int i=1i<3i++) MogDo = Shiji.nextInt(2)}
else if(YingxMP>2&&MogMP>2) MogDo = 2
else if(MogMP<4) {for(int i=1i<4i++) MogDo = Shiji.nextInt(3)}
else MogDo = 3}
//噩梦难度
if(ND==3){
if(Do==1) MogDo=1
if(Do==2&&MogMP>0) MogDo=2
if(Do==2&&MogMP==0) MogDo=0
if(Do==3&&MogMP<4) MogDo=0
if(Do==3&&MogMP>=4) MogDo=3}//变态判定。。
//战斗分析
//防御
if(Do==3) {fangyu=1System.out.println("你灵巧的躲避攻击!")}
if(MogDo==1) {fangyu=1System.out.println("恶龙进行防御!")}
//角色判定
if(Do==1&&YingxMP==0) {System.out.println("MP不足!")}
if(Do==1&&YingxMP>0) {
if(fangyu==0) {MogHP=MogHP-1YingxMP=YingxMP-1System.out.println("你发动攻击!")}
if(fangyu==1) {YingxMP=YingxMP-1System.out.println("你的攻击被格挡!")}}
if(Do==2) {YingxMP=YingxMP+1System.out.println("你进行蓄力!")}
if(Do==4&&YingxMP<3) {System.out.println("MP不足!")}
if(Do==4&&YingxMP>2) {MogHP=MogHP-2YingxMP=YingxMP-3System.out.println("你发动重击!")}
if(Do>4) System.out.println("你不知所措...")
//敌人判定
if(MogDo==2&&MogMP==0) {System.out.println("恶龙在发呆!")}
if(MogDo==2&&MogMP>0) {
if(fangyu==0) {YingxHP=YingxHP-2MogMP=MogMP-1System.out.println("恶龙发动攻击!")}
if(fangyu==1) {MogMP=MogMP-1System.out.println("恶龙的攻击被躲开了!")}}
if(MogDo==0) {MogMP=MogMP+1System.out.println("恶龙进行蓄力!")}
if(MogDo==3&&MogMP<4) {System.out.println("恶龙在发呆!")}
if(MogDo==3&&MogMP>3) {YingxHP=YingxHP-4MogMP=MogMP-4System.out.println("恶龙发动火焰吐吸!躲避不能!")}
//结束
fangyu = 0
MogDo = 0
System.out.println("____________________")
System.out.println()
System.out.println("==================================") }
}
}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)