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("对不起,积分不够");
} }
使用面向对象的思想实现物品回赠.
不知道错在哪里了 晕

解决方案 »

  1.   

    SendFlft是什么??有这个吗??
      

  2.   

    根据你的意图我揣测:
    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方法,应该是不会有问题的..
      

  3.   

    以下是修改后的程序:
    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;
    }
      

  4.   

    class SendFlft { 
    public String shouji=null; 
    public String diannao=null; 
    }这句是什么意思哩
      

  5.   

    getShouji()、setShouji()和getDiannao()、setDiannao()方法是什么