import java.util.Scanner;
/**
* 阶段5
*
*使用面向对象思想实现礼品馈赠
*
*礼品馈赠类
*
*/
public class SendGiftDemo {
public String present1="价值4300.0的诺基亚N73手机";
public String present2="价值12000.0的苹果笔记本电脑";
public int score;
public String toString()
{
return "恭喜!获赠礼品:一个"+present1;
}
public String b()
{
return "恭喜!获赠礼品:一个"+present2;
}
public void c()
{
Scanner a=new Scanner(System.in);
System.out.println("请输入会员号:");
String name=a.next();
System.out.println("请输入积分:");
int corse=a.nextInt();
}import java.util.Scanner;/**
*
* 阶段5
*
*使用面向对象思想实现礼品馈赠
*
*测试礼品馈赠类
*/
public class SendGift {
public static void main(String[] args) {
String answer;
Scanner a=new Scanner(System.in);
SendGiftDemo s=new SendGiftDemo();
System.out.println("我行我素购物管理系统>礼品馈赠\n");
do
{
s.c();
if(s.score<15000&&s.score>=8000)
System.out.print(s.toString());
else if(s.score>=15000)
System.out.print(s.b());
System.out.print("是否继续(Y/N)");
answer=a.next();
}while(answer.equalsIgnoreCase("Y"));
System.out.print("程序结束!!");
}}谁帮我看看这出了什么问题,eclipse里面编译没错,就是运行的时候叫你输入以后就直接Y/N了.输出不了我的SYSTEM.out.print内容,
/**
* 阶段5
*
*使用面向对象思想实现礼品馈赠
*
*礼品馈赠类
*
*/
public class SendGiftDemo {
public String present1="价值4300.0的诺基亚N73手机";
public String present2="价值12000.0的苹果笔记本电脑";
public int score;
public String toString()
{
return "恭喜!获赠礼品:一个"+present1;
}
public String b()
{
return "恭喜!获赠礼品:一个"+present2;
}
public void c()
{
Scanner a=new Scanner(System.in);
System.out.println("请输入会员号:");
String name=a.next();
System.out.println("请输入积分:");
int corse=a.nextInt();
}import java.util.Scanner;/**
*
* 阶段5
*
*使用面向对象思想实现礼品馈赠
*
*测试礼品馈赠类
*/
public class SendGift {
public static void main(String[] args) {
String answer;
Scanner a=new Scanner(System.in);
SendGiftDemo s=new SendGiftDemo();
System.out.println("我行我素购物管理系统>礼品馈赠\n");
do
{
s.c();
if(s.score<15000&&s.score>=8000)
System.out.print(s.toString());
else if(s.score>=15000)
System.out.print(s.b());
System.out.print("是否继续(Y/N)");
answer=a.next();
}while(answer.equalsIgnoreCase("Y"));
System.out.print("程序结束!!");
}}谁帮我看看这出了什么问题,eclipse里面编译没错,就是运行的时候叫你输入以后就直接Y/N了.输出不了我的SYSTEM.out.print内容,
解决方案 »
- ConcurrentModificationException如何解决
- Java访问Access2003的日期问题
- java 匿名类与接口的用法
- Java转.Net的迷茫,盼达人解惑
- 怎样用java得到硬盘得序列号,谢谢
- 去急救,高手请出招。js里能把var变量的值赋值给java变量吗?
- 请教:DatabaseMetaData接口中某些方法中catalog 参数是指数据库的什么东东呀?
- 奇怪的问题,难道是传说中的Borland公司久未透露的JBuilder里的BUG?
- 怎样配置jbuilder6.0中的编译环境
- 高手请指点迷津,为什么我的程序不能执行?
- 正则表达式 截取URL
- [中文乱码]JAVA,IO字符集转换
/**
* 阶段5
*
*使用面向对象思想实现礼品馈赠
*
*礼品馈赠类
*
*/
public class SendGiftDemo {
public String present1="价值4300.0的诺基亚N73手机";
public String present2="价值12000.0的苹果笔记本电脑";
public int score; public String toString()
{
return "恭喜!获赠礼品:一个"+present1;
}
public String b()
{
return "恭喜!获赠礼品:一个"+present2;
}
public void c()
{
Scanner a=new Scanner(System.in);
System.out.println("请输入会员号:");
String name=a.next();
System.out.println("请输入积分:");
//int corse=a.nextInt();
score=a.nextInt}
}
你看看着色部分就分明白,为什么会直接输出Y/N了
判断条件不成立。所以不会输出。
这样的问题debug一下就能够发现问题了,lz不够细心哦。