一、制作筛子游戏:

//2018.12.27 赌筛子游戏

import java.util.Scanner;

public class Plan {
public static void main(String[] arge) {
Scanner sc=new Scanner(System.in); //代表键盘
int money = 1000;
//开始游戏界面
System.out.println("************"+"欢迎来到小郑大赌场"+"************");
System.out.println("是否开始游戏:yes/no");
String plan = sc.nextLine();
if(!"no".equals(plan)) {
//玩家选择no则游戏结束
System.out.println("请开始下注:");
int pay = sc.nextInt();
// 生成三个随机的筛子
int a = (int)(Math.random()*6)+1;
int b = (int)(Math.random()*6)+1;
int c = (int)(Math.random()*6)+1;
//开始选择压大压小
String result = (a+b+c)>9?"大":"小";
System.out.println("请压大小:");
String guess = sc.next();
if(result.equals(guess)) {

money += pay;
System.out.println(a+","+b+","+c);
System.out.println("恭喜您压中了");
System.out.println("账户余额为:"+money);
}else {
money -= pay;
System.out.println(a+","+b+","+c);
System.out.println("很遗憾您未压中");
System.out.println("账户余额为:"+money);
}
}else {
System.out.println("欢迎下次来玩");
}
}
}

二 学习计划135学习246休息 其他休息

// 2018.12.27 课堂作业

import java.util.Scanner;


public class Class {
public static void main(String[] arge) {
Scanner sc=new Scanner(System.in); //代表键盘
System.out.println("请输入星期几:");
// book 代表读书
int book = sc.nextInt();
switch(book) {
case 1:
case 3:
case 5:
System.out.println("学习");
break;
case 2:
case 4:
case 6:
System.out.println("复习");
break;
default:
System.out.println("休息");



}

}
}

 

三、课后作业第三题

//2018.12.27书本练习题第三题

import java.util.Scanner;

public class Zuoye {
public static void main(String[] arge) {
Scanner sc=new Scanner(System.in); //代表键盘
//输出机票 airMonry
double airMoney = 5000.0;
System.out.println("请输入您出行的月份:");
int mount= sc.nextInt();
System.out.println("请问您选择头等舱还是经济舱?头等舱输入1,经济舱输入2");
int air=sc.nextInt();
double money = 0;
if(mount>3 && mount<11) { //月份mount
if (air==1) {
money =airMoney*0.9;
System.out.println("您的机票价格为:"+money);
}else {
money =airMoney*0.6;
System.out.println("您的机票价格为:"+money);

}
}else {
if (air==1) {
money=airMoney*0.5;
System.out.println("您的机票价格为:"+money);
}else {
if(air==1) {
money=airMoney*0.4;
System.out.println("您的机票价格为:"+money);

}

}

}
}

posted on 2018-12-27 17:05  郑富兴  阅读(106)  评论(0编辑  收藏  举报