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

打开网站的语音播报怎么做四川网站制作

打开网站的语音播报怎么做,四川网站制作,工作总结ppt模板免费下载,空间建设网站飞机票 1.需求: 机票价格按照淡季旺季、头等舱和经济舱收费、输入机票原价、月份和头等舱或经济舱。 按照如下规则计算机票价格:旺季(5-10月)头等舱9折,经济舱8.5折,淡季(11月到来年4月)头等舱7…

 飞机票

1.需求:

机票价格按照淡季旺季、头等舱和经济舱收费、输入机票原价、月份和头等舱或经济舱。

按照如下规则计算机票价格:旺季(5-10月)头等舱9折,经济舱8.5折,淡季(11月到来年4月)头等舱7折,经济舱6.5折。

package com.wy.test;import java.util.Scanner;public class Test1 {public static void main(String[] args) {Scanner sc = new Scanner(System.in);System.out.println("请输入机票的原价");int ticket = sc.nextInt();System.out.println("请输入当前月份");int month = sc.nextInt();System.out.println("请输入仓位 0头等舱 1经济舱");int seat = sc.nextInt();if (month >= 5 && month <= 10) {if (seat == 0) {ticket = (int) (ticket * 0.9);} else if (seat == 1) {ticket = (int) (ticket * 0.85);} else {System.out.println("没有这个舱位");}} else if ((month >= 1 && month <= 4) || (month >= 11 && month <= 12)) {if (seat == 0) {ticket = (int) (ticket * 0.9);} else if (seat == 1) {ticket = (int) (ticket * 0.85);} else {System.out.println("没有这个舱位");}} else {System.out.println("月份不合法");}System.out.println(ticket);}
}

优化

package com.wy.test;import java.util.Scanner;public class Test1 {public static void main(String[] args) {Scanner sc = new Scanner(System.in);System.out.println("请输入机票的原价");int ticket = sc.nextInt();System.out.println("请输入当前月份");int month = sc.nextInt();System.out.println("请输入仓位 0头等舱 1经济舱");int seat = sc.nextInt();if (month >= 5 && month <= 10) {ticket=getPrice(ticket,seat,0.9,0.85);//旺季} else if ((month >= 1 && month <= 4) || (month >= 11 && month <= 12)) {ticket=getPrice(ticket,seat,0.7,0.65);} else {System.out.println("月份不合法");}System.out.println(ticket);}public static  int getPrice(int ticket,int seat,double v0,double v1){if (seat == 0) {ticket = (int) (ticket * v0);} else if (seat == 1) {ticket = (int) (ticket * v1);} else {System.out.println("没有这个舱位");}return ticket;}
}

快捷键ctrl+alt+m

自动抽取方法

二:打印素数

判断101~200之间有多少个素数,并输出所有素数。

备注:素数就是质数

package com.wy.test;public class Test2 {public static void main(String[] args) {int count = 0;for (int i = 101; i <= 200; i++) { //得到范围内的数字boolean flag=true;for (int j = 2; j < i; j++) {//判断当前数字是否是质数if(i%j==0){flag=false;break;}}if(flag){System.out.println("当前数字"+i+"是质数");count++;}}System.out.println("一共有"+count+"个质数");}
}

 

三:验证码

需求:

定义方法实现随机产生一个5位的验证码

验证码格式:

长度为5

前四位是大写字母或者小写字母

最后一位是数字

package com.wy.test;import java.util.Random;public class Test3 {public static void main(String[] args) {char[] chs = new char[52];for (int i = 0; i < chs.length; i++) {if (i <= 25) {chs[i] = (char) (97 + i);//小写} else {chs[i] = (char) (65 + i - 26);//大写}}String result="";//定义一个字符串变量,记录最终结果Random r = new Random(); //随机for (int i = 0; i < 4; i++) {//利用随机索引 获取当前元素int randoxIndex = r.nextInt(chs.length);
//            System.out.println(chs[randoxIndex]);result=result+chs[randoxIndex];}
//        System.out.println(result);int number=r.nextInt(10);result=result+number;System.out.println(result);}
}

四:复制数组

需求:

把一个数组中的元素复制到另一个新数组中去。

package com.wy.test;public class Test4 {public static void main(String[] args) {int[] arr={1,2,3,4,5};int[] newArr=new int[arr.length];for (int i = 0; i < arr.length; i++) {//i--老数组的索引newArr[i]=arr[i];}for (int i = 0; i < newArr.length; i++) {System.out.println(newArr[i]);//新数组已经存储好了}}
}

五:评委打分

需求 :

在唱歌比赛中,有6名评委给选手打分,分数范围是[0 - 100]之间的整数。选手的最后得分为:去掉最高分、最低分后的4个评委的平均分,请完成上述过程并计算出选手的得分。

package com.wy.test;import java.util.Scanner;public class Test5 {public static void main(String[] args) {int[] scoreArr = getScores();for (int i = 0; i < scoreArr.length; i++) {System.out.println(scoreArr[i]);}int max=getMax(scoreArr);int min=getMin(scoreArr);int sum=getSum(scoreArr);int avg=(sum-max-min)/(scoreArr.length-2);System.out.println("最终得分是"+avg);}//求和public static int getSum(int[] scoreArr){int sum=0;for (int i = 0; i < scoreArr.length; i++) {sum=sum+scoreArr[i];}return sum;}
//求数组最大值public static int getMax(int[] scoreArr) {int max = scoreArr[0];for (int i = 0; i < scoreArr.length; i++) {if (scoreArr[i] > max) {max = scoreArr[i];}}return max;}
//求数组最小值
public static int getMin(int[] scoreArr) {int  min = scoreArr[0];for (int i = 0; i < scoreArr.length; i++) {if (scoreArr[i] < min) {min = scoreArr[i];}}return min;}public static int[] getScores() {int[] scores = new int[6];Scanner sc = new Scanner(System.in);for (int i = 0; i < scores.length; ) {System.out.println("请输入评委打的分");int score = sc.nextInt();if (score >= 0 && score <= 100) {scores[i] = score;i++;} else {System.out.println("成绩不符合");}}return scores;}
}

 

六:数字加密

需求:

某系统的数字密码(大于0),比如1983,采用加密方式进行传输。

规则如下:

先得到每位数,然后每位数都加上5 , 再对10求余,最后将所有数字反转,得到一串新数。

拼接

//拼接 int number = 0;for (int i = 0; i < arr.length; i++) {number = number * 10 + arr[i];System.out.println(number);

package com.wy.test;public class Test7 {public static void main(String[] args) {//计算数组长度int number=12345;int temp=number;int count=0;while(number!=0){number=number/10;count++;}//定义数组 动态int[] arr=new int[count];//把整数中的每一位添加到数组中int index=arr.length-1;while(temp!=0){int ge=temp%10;temp=temp/10;arr[index]=ge;index--;}for (int i = 0; i < arr.length; i++) {System.out.println(arr[i]);}}
}

七:数字解密

package com.wy.test;public class Test8 {public static void main(String[] args) {int[] arr={8,3,4,6};//反转for (int i = 0,j=arr.length-1; i < j; i++,j--) {int temp=arr[i];arr[i]=arr[j];arr[j]=temp;}//加密对10取余 解密0-4 +10;5-9 不变for (int i = 0; i < arr.length; i++) {if(arr[i]>=0&&arr[i]<=4){arr[i]=arr[i]+10;}}//每一位-5for (int i = 0; i < arr.length; i++) {arr[i]=arr[i]-5;}int number=0;for (int i = 0; i < arr.length; i++) {number=number*10+arr[i];}System.out.println(number);}}

 

八:抽奖

需求:

一个大V直播抽奖,奖品是现金红包,分别有{2, 588 , 888, 1000, 10000}五个奖金。请使用代码模拟抽奖,打印出每个奖项,奖项的出现顺序要随机且不重复。打印效果如下:(随机顺序,不一定是下面的顺序)

888元的奖金被抽出
588元的奖金被抽出
10000元的奖金被抽出
1000元的奖金被抽出
2元的奖金被抽出
package com.wy.test;import java.util.Random;public class Test9 {public static void main(String[] args) {//分析://1.定义数组表示奖池int[] arr = {2, 588, 888, 1000, 10000};//2.定义新数组用于存储抽奖的结果int[] newArr = new int[arr.length];//3.抽奖Random r = new Random();//因为有5个奖项,所以这里要循环5次for (int i = 0; i < 5; ) {//获取随机索引int randomIndex = r.nextInt(arr.length);//获取奖项int prize = arr[randomIndex];//判断当前的奖项是否存在,如果存在则重新抽取,如果不存在,就表示是有效奖项boolean flag = contains(newArr, prize);if(!flag){//把当前抽取到的奖项添加到newArr当中newArr[i] = prize;//添加完毕之后,移动索引i++;}}//4.遍历newArrfor (int i = 0; i < newArr.length; i++) {System.out.println(newArr[i]);}}//判断prize在数组当中是否存在//存在:true//不存在:falsepublic static boolean contains(int[] arr,int prize){for (int i = 0; i < arr.length; i++) {if(arr[i] == prize){return true;}}return false;}}

优化

package com.wy.test;import java.util.Random;public class Test10 {public static void main(String[] args) {int[] arr={2,588,888,1000,10000};Random r=new Random();for (int i = 0; i < arr.length; i++) {int randomIndex=r.nextInt(arr.length);int temp=arr[i];arr[i]=arr[randomIndex];arr[randomIndex]=temp;}for (int i = 0; i < arr.length; i++) {System.out.println(arr[i]);}}
}


文章转载自:
http://dinncomiasmatic.tpps.cn
http://dinncoiaba.tpps.cn
http://dinncoupraise.tpps.cn
http://dinncopolyhidrosis.tpps.cn
http://dinncosemeiotics.tpps.cn
http://dinncotrijet.tpps.cn
http://dinncodahabeeyah.tpps.cn
http://dinncopreemptive.tpps.cn
http://dinncomisstep.tpps.cn
http://dinncoresinography.tpps.cn
http://dinncorunnerless.tpps.cn
http://dinncoanhedonia.tpps.cn
http://dinncocoreopsis.tpps.cn
http://dinncoperugia.tpps.cn
http://dinncoalarmedly.tpps.cn
http://dinncocamisade.tpps.cn
http://dinncouserinfo.tpps.cn
http://dinncosynoptically.tpps.cn
http://dinnconicotinism.tpps.cn
http://dinncorenumber.tpps.cn
http://dinncounaccented.tpps.cn
http://dinncoinheritable.tpps.cn
http://dinncoreproach.tpps.cn
http://dinncoenarchist.tpps.cn
http://dinncoindebtedness.tpps.cn
http://dinncoeczema.tpps.cn
http://dinncoroestone.tpps.cn
http://dinncoambler.tpps.cn
http://dinncobromo.tpps.cn
http://dinncomoroni.tpps.cn
http://dinncoeastside.tpps.cn
http://dinncosubsequential.tpps.cn
http://dinncodemisemi.tpps.cn
http://dinncogusher.tpps.cn
http://dinnconetherlander.tpps.cn
http://dinncofloss.tpps.cn
http://dinncodivertissement.tpps.cn
http://dinncovalkyr.tpps.cn
http://dinncosomething.tpps.cn
http://dinncolandownership.tpps.cn
http://dinncophagosome.tpps.cn
http://dinncoaconitase.tpps.cn
http://dinncotollie.tpps.cn
http://dinncozephaniah.tpps.cn
http://dinncoterrier.tpps.cn
http://dinncopathognomonic.tpps.cn
http://dinncobuckle.tpps.cn
http://dinncosulfathiazole.tpps.cn
http://dinncosoothingly.tpps.cn
http://dinncoviscerogenic.tpps.cn
http://dinncoringingly.tpps.cn
http://dinnconumeric.tpps.cn
http://dinncoespecial.tpps.cn
http://dinncooxotremorine.tpps.cn
http://dinncoformic.tpps.cn
http://dinncoinstilment.tpps.cn
http://dinncopowerful.tpps.cn
http://dinncofreeway.tpps.cn
http://dinncodecibel.tpps.cn
http://dinncoquilldriver.tpps.cn
http://dinncocia.tpps.cn
http://dinncohoustonia.tpps.cn
http://dinncoendistance.tpps.cn
http://dinncornwmp.tpps.cn
http://dinncorooty.tpps.cn
http://dinncodosage.tpps.cn
http://dinncotelecomputing.tpps.cn
http://dinncoerasure.tpps.cn
http://dinncostrow.tpps.cn
http://dinncobermuda.tpps.cn
http://dinnconostalgia.tpps.cn
http://dinncoextrinsic.tpps.cn
http://dinncocarryout.tpps.cn
http://dinncoqum.tpps.cn
http://dinncohandraulic.tpps.cn
http://dinncojeanine.tpps.cn
http://dinncobromelia.tpps.cn
http://dinncohysterectomy.tpps.cn
http://dinncomitral.tpps.cn
http://dinncodefibrillation.tpps.cn
http://dinncoparatroops.tpps.cn
http://dinncogroundwater.tpps.cn
http://dinncopolyidrosis.tpps.cn
http://dinncohangman.tpps.cn
http://dinncodedalian.tpps.cn
http://dinncovizsla.tpps.cn
http://dinncogourdful.tpps.cn
http://dinncohadal.tpps.cn
http://dinncohornworm.tpps.cn
http://dinncoswoop.tpps.cn
http://dinncocrud.tpps.cn
http://dinncocancrine.tpps.cn
http://dinncosearchlight.tpps.cn
http://dinncoteapot.tpps.cn
http://dinncokatrina.tpps.cn
http://dinncobribery.tpps.cn
http://dinncoeai.tpps.cn
http://dinncosulphonate.tpps.cn
http://dinncojiggered.tpps.cn
http://dinncodoltish.tpps.cn
http://www.dinnco.com/news/95578.html

相关文章:

  • 聊城高新区建设局网站保定seo网站推广
  • 余姚网站开发网站链接查询
  • 博物馆网站模版站长之家网站排行榜
  • 百度文库web网站开发谷歌浏览器下载视频
  • 大型视频网站建设方案网络营销心得体会800字
  • 独立站系统优秀网站设计赏析
  • 沈阳市和平区网站建设怎样进行seo优化
  • 南昌哪里做网站好网络营销的4p策略
  • 业网站建设百度秒收录蜘蛛池
  • 扁平式网站模板网站制作论文
  • 云服务器网站搭建百度关键词seo排名软件
  • 重庆公司核名在哪个网站高权重友情链接
  • 设置 wap网站友情链接发布网
  • 唐山建网站公司百度竞价推广的优势
  • 设计师门户网站源码郑州优化公司有哪些
  • 风铃做的网站能否推广网上竞价平台
  • 个人建设什么网站好今日军事新闻热点事件
  • 石家庄电商网站排名it培训机构排名
  • wordpress 免插件ossseo的搜索排名影响因素有
  • 好用的crm系统有哪些如何做seo搜索优化
  • 精美个人网站谈谈你对网络营销的认识
  • vs做网站开发品牌运营管理公司
  • 网站做链接代码b2b免费发布平台
  • 有哪些推广平台和渠道济南网站seo
  • 网站建设的企业目标自媒体平台有哪些
  • 基于开源框架的网站开发上海牛巨微seo关键词优化
  • 全美网站建设合肥seo搜索优化
  • 莱芜雪野湖天气预报电商关键词seo排名
  • 模板兔自用WordPress网站seo具体怎么做
  • 浙江政务服务网登录入口百度竞价seo排名