初学Java 彩票
2024-09-05 23:24:53
import java.util.Scanner; public class Lottery {
public static void main(String[] agrs) {
int lottery = (int)(Math.random() * ); Scanner input = new Scanner(System.in);
System.out.print("Enter your lottery pick (two digits): ");
int guess = input.nextInt(); int lotteryDigit1 = lottery / ;
int lotteryDigit2 = lottery % ; int guessDigit1 = guess / ;
int guessDigit2 = guess % ; System.out.println("The lottery number is " + lottery); if (guess == lottery)
System.out.println("exact match: you win $10000");
else if (guessDigit2 == lotteryDigit1
&& guessDigit1 == lotteryDigit2)
System.out.println("Math all digits: you win $3000");
else if (guessDigit1 == lotteryDigit1
|| guessDigit1 == lotteryDigit2
|| guessDigit2 == lotteryDigit1
|| guessDigit2 == lotteryDigit2)
System.out.println("Match one digit: you win $1000");
else
System.out.println("Sorry, no macth");
}
}
最新文章
- js继承方式
- CSS3两个动画顺序衔接播放
- 使用Microsoft.Office.Interop.Excel.Application xlApp 生成Excel
- ubuntu apache开启重写模块
- oracle将多条数据合并成一条
- setjmp 与 longjmp
- Easyui datebox控件打开页面就验证解决方法
- 自己做个 Tag标签
- 【ASP.NET MVC 学习笔记】- 13 Child Action
- office 32-bit components 2010 的卸载
- C# MemoryCache GCHandle
- 尚硅谷springboot学习30-docker安装mysql示例
- 卸载ros的方法
- angular file change
- 2018-2019-2 《网络对抗技术》Exp2 后门原理与实践 Week4 20165233
- C#高级编程9 第14章 内存管理和指针
- [driver]/lib/modules
- 20135320赵瀚青LINUX内核分析第四周学习笔记
- 2019.3.28 JDBC相关
- ubuntu 12.10 apt-get 源