1、製做篩子游戲:java
//2018.12.27 賭篩子游戲dom
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("歡迎下次來玩");
}
}
}blog
二 學習計劃135學習246休息 其餘休息遊戲
// 2018.12.27 課堂做業it
import java.util.Scanner;class
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("休息");
}
}
}import
3、課後做業第三題im
//2018.12.27書本練習題第三題next
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);
}
}
}
}