java刷礼物代码 java幸运抽奖代码

求大神帮忙,好朋友过生日,喜欢五月天,求一个java代码写的程序做生日礼物!classBirth{privateStringbirth;privateStringsname;privateStringinterest;privateStringbook;privateStringfilm;publicvoidsetBirth(Stringbirth){this.birth=birth;}publicvoidsetName(Stringsname){this.sname=sname;}publicvoidsetInterest(Stringinterest){this.interest=interest;}publicvoidsetBook(Stringbook){this.book=book;}publicvoidsetFilm(Stringfilm){this.film=film;}publicStringgetBirth(){returnbirth;}publicStringgetName(){returnsname;}publicStringgetInterest(){returninterest;}publicStringgetBook(){returnbook;}publicStringgetFilm(){returnfilm;}publicvoidoutPut(){System.out.println("YourNameis:"+this.getName());System.out.println("YourBirthis:"+this.getBirth());System.out.println("YourInterestis:"+this.getInterest());System.out.println("YourBookis:"+this.getBook());System.out.println("Yourfilmis:"+this.getFilm());}}publicclassTestBirth{publicstaticvoidmain(String[]args){Birthbr=newBirth();br.setName("xuwenpeng");br.setBirth("1987/03/04");br.setInterest("basketball");br.setFilm("aidefengxiang");br.setBook("java");br.outPut();}}Result:YourNameis:xuwenpengYourBirthis:1987/03/04YourInterestis:basketballYourBookis:javaYourfilmis:aidefengxiang
java生日蛋糕和玫瑰(百合也可)的代码(急需),需送人用*号打印的生日蛋糕或玫瑰百合?
。。。。println("* * ****");
就这样打出来??
商场推出幸运抽奖活动的java初级代码编写public class Lucky {
public static void main(String[] args){
System.out.println("请输入您的4位会员卡号:");
Scanner sc = new Scanner(System.in);
int number = sc.nextInt();//接收用户从控制台输入的会员卡号 , 并保存在会员卡号变量中
int a = number/1000;//千位
int b = number%1000/100; //百位
int c = number%100/10; //十位
int d = number%10;//个位
if((a+b+c+d)20){
System.out.println("恭喜中奖!您是幸运客户");
}else{
System.out.println("谢谢参与!");
}
}
}
最基础的 没有异常判断 无限循环输入什么东西
能不能帮我写一个模拟抽奖机的JAVA代码 1到32的八个数字代码如下:
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class Luck extends JFrame implements ActionListener{
JTextField tf = new JTextField();
JButton b1 = new JButton("开始");
JButton b2 = new JButton("停止");
boolean isGo = false;
public Luck(){
b1.setActionCommand("start");
JPanel p = new JPanel();
p.add(b1);
p.add(b2);
b1.addActionListener(this);
b2.addActionListener(this);
b2.setEnabled(false);
this.getContentPane().add(tf,"North");
this.getContentPane().add(p,"South");
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.setSize(300,200);
this.setLocation(300,300);
Cursor cu = new Cursor(Cursor.HAND_CURSOR);
this.setCursor(cu);
this.setVisible(true);
tf.setText("welcome you!");
this.go();
}
public void go(){
while(true){
if(isGo == true){
String s = "";
for(int j = 1; j = 8;j++){
int i = (int)(Math.random() * 31) + 1;
if(i10){
s = s + "0" + i;
}else{
s = s + "" + i;
}
}
tf.setText(s);
}
try{
Thread.sleep(10);
}catch(java.lang.InterruptedException e){
e.printStackTrace();
}
}
}
public void actionPerformed(ActionEvent e){
String s = e.getActionCommand();
if(s.equals("start")){
isGo = true;
b1.setEnabled(false);
b2.setEnabled(true);
【java刷礼物代码 java幸运抽奖代码】}else{
isGo = false;
b2.setEnabled(false);
b1.setEnabled(true);
}
}
public static void main(String[] args){

推荐阅读