当前位置: 首页 > news >正文

网站上实用的h5特效销售管理系统免费版

网站上实用的h5特效,销售管理系统免费版,买链接网站,wordpress自动加标签《面向对象综合训练01~05》 训练01#xff1a;文字版格斗游戏 第一步#xff1a;创建游戏角色的javabean类 public class Role {private String name;private int blood;private char gender;private String face;//长相是随机的//创建男女长相的随机数组String[] boyfaces…《面向对象综合训练01~05》 训练01文字版格斗游戏 第一步创建游戏角色的javabean类 public class Role {private String name;private int blood;private char gender;private String face;//长相是随机的//创建男女长相的随机数组String[] boyfaces {风流俊雅, 气字轩昂, 相貌英俊, 五官端正, 相貌平平, 一塌糊涂, 面目狰狞};String[] girlfaces {美奂绝伦, 沉鱼落雁, 婷婷玉立, 身材娇好, 相貌平平, 相貌简陋, 惨不忍睹};//attack 攻击描述:String[] attacks_desc {%s使出了一招【背心钉】转到对方的身后一掌向%s背心的灵台穴拍去。,%s使出了一招【游空探爪】飞起身形自半空中变掌为抓锁向%s.,%s大喝一声身形下伏一招【劈雷坠地】捶向%s双腿。n,%s运气于掌一瞬间掌心变得血红一式【掌心雷】推向%s。,%s阴手翻起阳手跟进一招【没遮拦】结结实实的捶向%s。,%s上步抢身招中套招一招【劈挂连环】连环攻向%s。};//injured 受伤描述:String[] injureds_desc {结果%s退了半步毫发无损,结果给%s造成一处瘀伤,结果一击命中!%s痛得弯下腰,结果%s痛苦地闷哼了一声显然受了点内伤,结果%s摇摇晃晃一跤摔倒在地,结果%s脸色一下变得惨白连退了好几步,结果轰的一声%s口中鲜血狂喷而出,结果%s一声惨叫像滩软泥般塌了下去};public Role() {}public Role(String name, int blood, char gender) {this.name name;this.blood blood;this.gender gender;setFace(gender);}public String getName() {return name;}public void setName(String name) {this.name name;}public int getBlood() {return blood;}public void setBlood(int blood) {this.blood blood;}public char getGender() {return gender;}public void setGender(char gender) {this.gender gender;}public String getFace() {return face;}public void setFace(char gender) {//在初始化过程中使用setFace随机设置长相Random r new Random();if (gender 男) {//如果人物性别是男就从boyfaces随机一个长相int index r.nextInt(boyfaces.length);this.face boyfaces[index];} else if (gender 女) {//如果人物性别是男就从grilfaces随机一个长相int index r.nextInt(girlfaces.length);this.face girlfaces[index];} else {this.face 面目狰狞;}}//输出所创建角色的所有属性public void getInfoRole() {System.out.println(姓名 getName());System.out.println(血量 getBlood());System.out.println(性别 getGender());System.out.println(长相 getFace());}//设计一个攻击方法public void attack(Role role) {//首先描述攻击招式Random r new Random();int index r.nextInt(attacks_desc.length);System.out.printf(attacks_desc[index], this.getName(), role.getName());System.out.println();//计算造成的伤害int hurt r.nextInt(20) 1;//计算被攻击者剩余血量int remainBlood role.getBlood() - hurt;//对剩余血量做验证如果已经为负数了就修改为0remainBlood remainBlood 0 ? 0 : remainBlood;//修改被攻击者的剩余血量role.setBlood(remainBlood);//受伤情况描述if (remainBlood 90) {System.out.printf(injureds_desc[0], role.getName());} else if (remainBlood 80) {System.out.printf(injureds_desc[1], role.getName());} else if (remainBlood 70) {System.out.printf(injureds_desc[2], role.getName());} else if (remainBlood 60) {System.out.printf(injureds_desc[3], role.getName());} else if (remainBlood 40) {System.out.printf(injureds_desc[4], role.getName());} else if (remainBlood 20) {System.out.printf(injureds_desc[5], role.getName());} else if (remainBlood 10) {System.out.printf(injureds_desc[6], role.getName());} else {System.out.printf(injureds_desc[7], role.getName());}System.out.println();} }创建游戏测试类进行测试 public class GameTest {public static void main(String[] args) {//1.创建2个角色Role r1 new Role(乔峰, 100,男);Role r2 new Role(鸠摩智, 100,男);r1.getInfoRole();r2.getInfoRole();//2.使用while循环实现两个角色相互攻击while (true) {//r1先攻r2r1.attack(r2);//判断被攻击者的血量如果为0跳出输出结果、跳出循环if (r2.getBlood() 0) {System.out.println(r1.getName() K.O 了 r2.getName());break;}//r2再共计r1r2.attack(r1);//判断被攻击者的血量如果为0跳出输出结果、跳出循环if (r1.getBlood() 0) {System.out.println(r2.getName() K.O 了 r1.getName());break;}}} }训练02两个对象数组练习 对象数组练习1 定义数组存储3个商品对象商品的属性:商品的id名字价格库存。创建四个商品对象并把商品对象存入到数组当中 第一步创建商品的javabean类 public class Goods {private String id;private String name;private double price;private int count;public Goods() {}public Goods(String id, String name, double price, int count) {this.id id;this.name name;this.price price;this.count count;}public String getId() {return id;}public void setId(String id) {this.id id;}public String getName() {return name;}public void setName(String name) {this.name name;}public double getPrice() {return price;}public void setPrice(double price) {this.price price;}public int getCount() {return count;}public void setCount(int count) {this.count count;}Overridepublic String toString() {return Goods{ id id \ , name name \ , price price , count count };} }第二步定义数组创建4个商品对象并存入数组 public class GoodsTest {public static void main(String[] args) {//1.动态初始化创建数组Goods[] goods new Goods[4];//2.创建3个商品对象Goods g1 new Goods(001,华为P40,5999.0,100);Goods g2 new Goods(001,保温杯,239.0,50);Goods g3 new Goods(001,小米笔记本,6999.0,10);Goods g4 new Goods(001,苹果13手机,7999.0,59);//3.把商品对象存入数组中goods[0] g1;goods[1] g2;goods[2] g3;goods[3] g4;//3.打印数组for (int i 0; i goods.length; i) {Goods good goods[i];System.out.println(good.toString());}} }对象数组练习2 定义数组存储3部汽车对象汽车的属性:品牌价格颜色创建三个汽车对象数据通过键盘录入而来并把数据存入到数组当中 第一步创建汽车的javabean类 public class Cars {private String brand;private int price;private String color;public Cars() {}public Cars(String brand, int price, String color) {this.brand brand;this.price price;this.color color;}public String getBrand() {return brand;}public void setBrand(String brand) {this.brand brand;}public int getPrice() {return price;}public void setPrice(int price) {this.price price;}public String getColor() {return color;}public void setColor(String color) {this.color color;}Overridepublic String toString() {return Cars{ brand brand \ , price price , color color \ };} }第二步创建3个汽车对象使用键盘接收汽车属性并把3个汽车对象存入数组中 public class CarsTest {public static void main(String[] args) {//1.创建一个汽车数组Cars[] cars new Cars[3];//2.创建3个汽车对象使用键盘接收汽车属性并把3个汽车对象存入数组中Scanner scanner new Scanner(System.in);for (int i 0; i cars.length; i) {//创建汽车对象通过键盘接收汽车属性数据Cars car new Cars();//创建汽车对象一定要写在for循环的里面因为为我们要创建3和不同的对象System.out.println(请输入汽车的品牌);String brand scanner.next();car.setBrand(brand);System.out.println(请输入汽车的价格);int price scanner.nextInt();car.setPrice(price);System.out.println(请输入汽车的颜色);String color scanner.next();car.setColor(color);//把创建的汽车对象存入数组中cars[i] car;}//3.遍历数组for (int i 0; i cars.length; i) {System.out.println(cars[i].toString());}} }以上练习中需掌握键盘输入的两套体系第一套体系: nextInt();接收整数nextDouble();接收小数next();接收字符串遇到空格制表符回车就停止接受。这些符号后面的数据就不会接受了 第二套体系: nextLine();接收字符串可以接收空格制表符遇到回车才停止接受数据 以上练习中还需要注意Cars car new Cars();创建汽车对象一定要写在for循环的里面因为为我们要创建3和不同的对象 训练03两个对象数组练习-判断并统计 对象数组练习3 定义数组存储3部手机对象手机的属性:品牌价格颜色。要求计算出三部手机的平均价格 第一步创建手机javabean类 public class Phone {private String brand;private int price;private String color;public Phone() {}public Phone(String brand, int price, String color) {this.brand brand;this.price price;this.color color;}public String getBrand() {return brand;}public void setBrand(String brand) {this.brand brand;}public int getPrice() {return price;}public void setPrice(int price) {this.price price;}public String getColor() {return color;}public void setColor(String color) {this.color color;}Overridepublic String toString() {return Phone{ brand brand \ , price price , color color \ };} }第一步定义数组存储3部手机对象并计算出三部手机的平均价格 public class PhoneTest {public static void main(String[] args) {//1.创建一个大小为3的手机数组Phone[] phones new Phone[3];//2.创建3个手机对象Phone p1 new Phone(小米,3999,黑色);Phone p2 new Phone(华为,5999,蓝色);Phone p3 new Phone(苹果,7999,白色);//3.把3个手机对象存入数组中phones[0] p1;phones[1] p2;phones[2] p3;int sum 0;for (int i 0; i phones.length; i) {sum sum phones[i].getPrice();}int vag sum / phones.length;System.out.println(vag);} }对象数组练习4 定义数组存储4个女朋友的对象女朋友的属性:姓名、年龄、性别、爱好要求1:计算出四个女朋友的平均年龄要求2:统计年龄比平均值低的女朋友有几个?并把她们的所有信息打印出来 第一步创建女朋友的javabean类 public class GirlFriend {private String name;private int age;private String gender;private String hobby;public GirlFriend() {}public GirlFriend(String name, int age, String gender, String hobby) {this.name name;this.age age;this.gender gender;this.hobby hobby;}public String getName() {return name;}public void setName(String name) {this.name name;}public int getAge() {return age;}public void setAge(int age) {this.age age;}public String getGender() {return gender;}public void setGender(String gender) {this.gender gender;}public String getHobby() {return hobby;}public void setHobby(String hobby) {this.hobby hobby;}Overridepublic String toString() {return GirlFriend{ name name \ , age age , gender gender \ , hobby hobby \ };} } 第二步创建GirlFriendTest类实现功能 public class GirlFriendTest {public static void main(String[] args) {//1.定义数 组存储4个女朋友对象GirlFriend[] girlFriends new GirlFriend[4];//2.创建4个女朋对象GirlFriend gf1 new GirlFriend(小诗诗,18,萌妹子,吃零食);GirlFriend gf2 new GirlFriend(小丹丹,19,萌妹子,睡觉);GirlFriend gf3 new GirlFriend(小慧慧,20,萌妹子,看书);GirlFriend gf4 new GirlFriend(小艳艳,21,萌妹子,运动);//3.将4个对象添加到数组girlFriends[0] gf1;girlFriends[1] gf2;girlFriends[2] gf3;girlFriends[3] gf4;//4.计算4个女朋友的年龄之和int sum 0;for (int i 0; i girlFriends.length; i) {sum girlFriends[i].getAge();}//5.求平均年龄int vag sum / girlFriends.length;System.out.println(vag);//6.统计低于平均年龄的女朋友个数并打印出来int count 0;for (int i 0; i girlFriends.length; i) {if (girlFriends[i].getAge() vag){count;System.out.println(girlFriends[i].toString());}}System.out.println(count);} }训练05/06复杂对象数练习-添加、遍历、修改、删除 定义一个长度为3的数组数组存储1~3名学生对象作为初始数据 学生对象的学号姓名各不相同学生的属性:学号姓名年龄。 要求1:再次添加一个学生对象并在添加的时候进行学号的唯一性判断。 要求2:添加完毕之后遍历所有学生信息。 要求3:通过id删除学生信息,如果存在则删除如果不存在则提示删除失败。 要求4:删除完毕之后遍历所有学生信息。 要求5:查询数组id为“2”的学生如果存在则将他的年龄1岁。代码示例 public class StudentTest {/*定义一个长度为3的数组数组存储1~3名学生对象作为初始数据学生对象的学号姓名各不相同学生的属性:学号姓名年龄。要求1:再次添加一个学生对象并在添加的时候进行学号的唯一性判断。要求2:添加完毕之后遍历所有学生信息。要求3:通过id删除学生信息,如果存在则删除如果不存在则提示删除失败。要求4:删除完毕之后遍历所有学生信息。要求5:查询数组id为“2”的学生如果存在则将他的年龄1岁。*/public static void main(String[] args) {//1.定义一个长度为3的数组Student[] students new Student[3];//2.创建3个学生对象Student s1 new Student(1, 张三, 23);Student s2 new Student(2, 李四, 24);Student s3 new Student(3, 王五, 24);//3.将3个学生对象存入数组中students[0] s1;students[1] s2;students[2] s3;//4.创建一个新的学生对象Student s4 new Student(5, 赵六, 26);//5.判断新创建学生对象学号的唯一性设计一个方法判断新创建的学生对象的id是否包含在老数组中if (contains(students, s4.getId())) {//5.1已存在----提示id重复添加失败System.out.println(学生id重复添加失败);} else {//5.2不存在---添加新的学生对象//6.判断老数组是否已经存满数据设计一个方法判断来老数组数据是否已经存满int count getCount(students);System.out.println(count);if (count students.length) {//6.1数组已满则对创建比原数组空间大1个的新数组将新的学生对象存入其中students createArr(students);students[count] s4;//打印数组printArr(students);} else {//6.2数组没有存满直接将新学生对象存入其中students[count] s4;//打印数组printArr(students);}}//要求3:通过id删除学生信息,如果存在则删除如果不存在则提示删除失败。int index getIndex(students, 5);if (index 0) {//如果存在则删除students[index] null;System.out.println(删除成功);//要求4:删除完毕之后遍历所有学生信息。printArr(students);} else {//如果不存在则提示学生id不存在删除失败System.out.println(学生id不存在删除失败);}//要求5:查询数组id为“2”的学生如果存在则将他的年龄1岁。int index1 getIndex(students, 2);if (index1 0) {//id为2的学生存在,则将他的年龄1岁Student stu students[index1];int newAge stu.getAge() 1;stu.setAge(newAge);System.out.println(年龄1岁成功);printArr(students);} else {//id为2的学生不存在System.out.println(学生信息不存在修改失败);}}//设计一个方法获取待删除学生在数组中的位置/*1.我要个干嘛 答通过id获取学生对象在数组中的数组下标2.我需要什么 答需要数组学生id3.方法的调用处是否需要继续使用方法的结果 答需要如果存在则返回学生对象的数组下标如果不存在返回-1*/public static int getIndex(Student[] arr, int id) {for (int i 0; i arr.length; i) {if (arr[i] ! null) {if (arr[i].getId() id) {return i;}}}return -1;}//设计一个方法遍历数组元素public static void printArr(Student[] arr) {for (Student student : arr) {if (student ! null) {System.out.println(student);}}}//设计一个方法创建比原数组空间大1个的新数组/*1.我要个干嘛 答创建一个新数组比老数组空间大1并复制老数组元素到新数组中2.我需要什么 答需要老数组3.方法的调用处是否需要继续使用方法的结果 答需要需要返回新创建的数组*/public static Student[] createArr(Student[] arr) {Student[] newStudents new Student[arr.length 1];for (int i 0; i arr.length; i) {newStudents[i] arr[i];}return newStudents;}//设计一个方法判断新创建的学生对象的id是否包含在老数组中/*1.我要个干嘛 答判断新创建的学生对象的id是否包含在老数组中2.我需要什么 答需要老数组需要新创建学生对象的id3.方法的调用处是否需要继续使用方法的结果 答需要判断的结果*/public static boolean contains(Student[] arr, int id) {for (Student student : arr) {if (student ! null) {if (student.getId() id) {return true;}}}return false;}//设计一个方法判断来老数组数据已经存了几个数据/*1.我要个干嘛 答判断老数组数据已经存了几个数据2.我需要什么 答需要来老数组3.方法的调用处是否需要继续使用方法的结果 答需要返回已存入数据的数量*/public static int getCount(Student[] arr) {//创建一个统计变量int count 0;//判断数组中元素的值是否为null如果不是null则说明存在一个数据count加1for (Student student : arr) {if (student ! null) {count;}}//循环结束后返回数组中已添加元素的个数return count;} }
http://www.hkea.cn/news/14314679/

相关文章:

  • 任经理++徐州网站建设app推广是什么工作
  • 写一个网站需要什么技术凡科网站代码如何修改
  • 网站上做的广告有哪些种ug.wordpress
  • 济宁个人网站建设价格便宜网站开发 硬件环境
  • 在安阳想建个网站怎么做志鸿优化设计答案
  • 做网站的公司哪家怎么吧自己电脑做网站
  • ps兼职做网站如何建单位网站
  • 珠海做网站及推广往公众号里放网站怎么做
  • 企业网站建设湖南岚鸿WordPress推送至QQ
  • 优秀的网站开发网站建设方案总结
  • 百中搜网站建设建设网游小说
  • 做网站公司哪家公司好微信开发者平台工具
  • 网站被k了怎么做做网页推广的网站
  • 制作企业网站的软件河南省建设厅建筑业信息网
  • 企业品牌宣传型网站怎么自创公众号
  • wordpress relocateseo成创
  • 如何在工信部网站查询icpip网站提升流量
  • 中心城网站建设app软件系统开发
  • 网站没建设可以访问吗WordPress文档批量发布接口
  • 网站seo方案策划书网站建设时间计划
  • 昆明seo网站如何做好网络营销推广
  • 做网站找哪家又便宜又好南昌网站建设优化
  • 国内永久免费建站Wordpress 帖子翻译
  • 官方网站下载游戏百度爱采购平台登录
  • 网站建设私活中能找深圳seo优化公司哪家好
  • 企业做网站要注意些什么企业官网 源码 免费下载
  • 简述网站开发基本流程图网页游戏开服表大全
  • 嘉兴免费网站制作百度竞价推广代运营公司
  • 网站建设找客户渠道辽宁男科医院排名最好的医院
  • 福州医院网站建设公司福田欧曼est前四后八