急求小程序,用JAVA编写import java.util.Scanner;
public class NumberConvertor {
/**
* @param args
*/
public int input() {
Scanner scan = new Scanner(System.in);
int inputInt = 0;
while (true) {
try {
System.out.println("输入一个0-100的正整数(默认为0): ");
inputInt = scan.nextInt();
if (inputInt0 || inputInt = 100) {
System.out.println("越界");
continue;
} else {
break;
}
} catch (Exception e) {
System.out.println("输入有误,重新输入");
break;
}
}
return inputInt;
}
public String convert(int aInt) {
String[] table = new String[] { "零", "壹", "贰", "叁", "肆", "伍", "陆", "柒",
"捌", "玖", "拾" };
String result;
String left;
String right;
int leftInt;
int rightInt;
if (aInt = 10) {
result = table[aInt];
} else {
leftInt = Integer.parseInt((String.valueOf(aInt)).substring(0, 1));
rightInt = Integer.parseInt((String.valueOf(aInt)).substring(1));
left = table[leftInt];
right = table[rightInt];
result = left + table[10] + right;
}
return result;
}
public static void main(String[] args) {
NumberConvertor nc = new NumberConvertor();
int val;
val = nc.input();
System.out.println(nc.convert(val));
}
}
编写一个java小程序!public test_03(){
init();
}
public void init(){
JLabel jl_1=new JLabel("用户名");
JLabel jl_2=new JLabel("密码");
JTextField jtf=new JTextField();
JPasswordField jpf=new JPasswordField();
JButton button_1=new JButton("确定");
JPanel panel=new JPanel();
panel.setLayout(null);
jl_1.setBounds(30, 50, 50, 30);
jl_2.setBounds(30,90,50,30);
jtf.setBounds(100, 50, 100, 30);
jpf.setBounds(100, 90, 100, 30);
button_1.setBounds(110, 130, 80, 30);
panel.add(jl_1);
panel.add(jl_2);
panel.add(jtf);
panel.add(jpf);
panel.add(button_1);
this.add(panel);
this.setSize(300, 250);
this.setLocation(400, 300);
this.setVisible(true);
}
public static void main(String[] args) {
new test_03();
}
用JAVA编写一个小程序 , 不限类型好玩点的 。控制台小游戏 class YZDEL
{
public static void main(String[] args)
{
java.util.Random Shiji = new java.util.Random();
java.util.Scanner Shuru = new java.util.Scanner(System.in);
java.util.Scanner Nandu = new java.util.Scanner(System.in);
int YingxHP = 20;
int YingxMP = 0;
int MogHP = 20;
int MogMP = 0;
int MogDo = 0;
int fangyu = 0;
System.out.println("┏━━━━╮┏━━┣┣┓ ╮ ┓┏━┳━┳┓┓━┓ ");
System.out.println("┏┣━━━┓┏━━┣┣┓ ┃┏ ┃ ┃┓┃ ╯ ");
System.out.println("┣┣━━━┫╭━━┻╯╮ ┃╰┓┃ ┃╯┏━┣━━┓");
System.out.println("┣┣━━━┫┏━━━━┓╭━━┣━┛┗━┻━┻┛┃┃");
System.out.println("┏┣━━━┓┣━━━━┫ ┃┃┃┗╮╮┃┃┣━╯");
System.out.println(" ┛┗╯┗━━━━╯┗╯╰╰━━┛┛┗━╯╰━┛");
System.out.println();
System.out.println("作者:天狐空幻");
System.out.println();
System.out.println("说明:勇者的操作方式为以下所示:");
System.out.println("使用攻击需消耗1MP 伤害1HP");
System.out.println("使用蓄力可增加1MP 伤害0HP");
System.out.println("使用躲闪需消耗0MP 伤害0HP躲避攻击");
System.out.println("使用重击需消耗3MP 伤害2HP防御无效");
System.out.println("恶龙攻击力高,注意防御是取胜的关键");
推荐阅读
- 国外便宜的4核云服务器,国外服务器价格表
- c语言数组大小写转换,java字符数组大小写转换
- 毕业设计论文摘要模板网站,毕业设计论文摘要怎么写
- 唐诗手写小程序怎么做,唐诗手写小程序怎么做视频
- vb.net文件夹删除 vb中删除文件的命令
- oracle存储过程名大小写不同,oracle存储过程命名规范
- sqlserver载入主体,sql server导入数据
- 以前在头条直播芈月的主播,芈月玩的好的主播
- mysql怎么建立表格 mysql中怎么建表