import java.util.*;
public class PH5 { /**
* @param args
*/
public static void main(String[] args) {
SendFlft sendflft=new SendFlft();
SendFlft sendflft1=new SendFlft();
Scanner input=new Scanner(System.in);
System.out.print("请输入会员号:");
int huiyuan=input.nextInt();
System.out.print("请输入会员积分:");
int score=input.nextInt();
if(score>=8000&&score<15000){
sendflft.shouji="诺基亚N73手机";
System.out.print("sendflft");
}else if(score>=15000){
sendflft1.diannao="苹果笔记本电脑";
System.out.print("sendflft1");
}else{
System.out.print("对不起,积分不够");
} }
使用面向对象的思想实现物品回赠.
不知道错在哪里了 晕
public class PH5 { /**
* @param args
*/
public static void main(String[] args) {
SendFlft sendflft=new SendFlft();
SendFlft sendflft1=new SendFlft();
Scanner input=new Scanner(System.in);
System.out.print("请输入会员号:");
int huiyuan=input.nextInt();
System.out.print("请输入会员积分:");
int score=input.nextInt();
if(score>=8000&&score<15000){
sendflft.shouji="诺基亚N73手机";
System.out.print("sendflft");
}else if(score>=15000){
sendflft1.diannao="苹果笔记本电脑";
System.out.print("sendflft1");
}else{
System.out.print("对不起,积分不够");
} }
使用面向对象的思想实现物品回赠.
不知道错在哪里了 晕
解决方案 »
- 窗口有左右两个文本框,点击左文本框的某行文字,在右文本框显示这行文字,该怎么做呀?
- 如何检查一个字符串是否为文件(或是目录)?
- swing 窗口最小化后布局改变
- 谁能帮我解释一下下面代码?
- 请问JVM,ClassLoader以及类静态成员的关系,主要是对J2EE环境下Singleton实现的考虑
- xsl简单问题,请高手帮忙!急!
- 超容易问题~~最基础的。
- applet下如何用corba的命名服务,参数如何传递,急!(up有分)
- 请问如何将byte数组转化为char数组或一个String
- Jbuild里提供了一种按x,y坐标定位组件的方法,我觉得挺方便的,为什么好像大家都不用呢?
- 请教按列进行存储,按行调用的table的实现方法?
- python写入数据库的中文,用JAVA读就乱码
SendFlft 是你自己定义的一个类;
shouji和diannao是SendFlft类的一个属性;
那好,sendflft.shouji="诺基亚N73手机"和sendflft1.diannao="苹果笔记本电脑";
以上两条语句只是完成了对shouji和diannao属性的赋值;
而语句System.out.print("sendflft"); 和System.out.print("sendflft1"); 只是完成了输出字符串sendflft和sendflft1,并无实际意义,建议楼主在SendFlft 类中添加getShouji()、setShouji()和getDiannao()、setDiannao()方法,这样在你对shouji和diannao属性赋值之后在调用get方法,应该是不会有问题的..
import java.util.*;
public class PH5 { public static void main(String[] args) {
SendFlft sendflft=new SendFlft();
SendFlft sendflft1=new SendFlft();
Scanner input=new Scanner(System.in);
System.out.print("请输入会员号:");
int huiyuan=input.nextInt();
System.out.print("请输入会员积分:");
int score=input.nextInt();
if(score>=8000&&score <15000){
sendflft.shouji="诺基亚N73手机";
System.out.print(sendflft.shouji);
}else if(score>=15000){
sendflft.diannao="苹果笔记本电脑";
System.out.print(sendflft.diannao);
}else{
System.out.print("对不起,积分不够");
}
}
}
class SendFlft {
public String shouji=null;
public String diannao=null;
}
public String shouji=null;
public String diannao=null;
}这句是什么意思哩