java金卡积分反馈代码 会员积分系统java-成都创新互联网站建设

关于创新互联

多方位宣传企业产品与服务 突出企业形象

公司简介 公司的服务 荣誉资质 新闻动态 联系我们

java金卡积分反馈代码 会员积分系统java

java编程题 谢谢了

你这问题问了两遍,

创新互联公司主要从事网站设计制作、成都网站建设、网页设计、企业做网站、公司建网站等业务。立足成都服务临安,十载网站建设经验,价格优惠、服务专业,欢迎来电咨询建站服务:18982081108

我把我刚回答的给你粘过来:

比如该用户是User对象

user

积分增加之前获取该客户的当前积分和将要增加的积分,以及客户类型,如0代表普卡客户,1代表金卡客户,如:

double

current_point

=

user.getPoint();

double

point_add

=

xxxx;

int

cust_type

=

user.getCust_type();

判断:

user.setPoint(current_point

+

point_add);

if(cust_type

==

0){

if

(current_point

=

5000

(current_point

+

point_add

)

5000){

user.setPoint(current_point

+

point_add

+

500);

}

}else

if(cust_type

==

1){

if

(current_point

=

1000

(current_point

+

point_add

)

1000){

user.setPoint(current_point

+

point_add

+

500);

}

}else{

//返回错误信息:用户类型不存在

}

这只是个大体逻辑,现实应用中还有很多其他方面的细节,仅供参考

一道面向对象编程的JAVA题,每次用这种方式编程都是写两个java源文件,一个类 一个对象。

不知道楼主是不是这个要求

public class Test{

public static void main(String[] args) {

new Card("vip",2000).returnScore();

}

}

class Card{

private String cardType;

private int score;

public Card(String cardType,int score) {

this.cardType=cardType;

this.score=score;

}

public void returnScore(){

if("vip".equalsIgnoreCase(this.cardType)){

if(this.score1000){

System.out.println("积分:"+this.score+",卡类型:金卡");

System.out.println("回馈积分500分!");

}else{

System.out.println("积分:"+this.score+",卡类型:金卡");

System.out.println("无回馈积分!");

}

}else if("normal".equalsIgnoreCase(this.cardType)){

if(this.score5000){

System.out.println("积分:"+this.score+",卡类型:普通会员");

System.out.println("回馈积分500分!");

}else{

System.out.println("积分:"+this.score+",卡类型:普通会员");

System.out.println("无回馈积分!");

}

}

}

public String getCardType() {

return cardType;

}

public void setCardType(String cardType) {

this.cardType = cardType;

}

public int getScore() {

return score;

}

public void setScore(int score) {

this.score = score;

}

}

java练习,实现客户积分回馈.

坦白说这段代码看着蛋疼,

1 同一个类里,main方法可以直接调用static修饰的其他方法,比如你说的show方法,

2 如果你想面向对象的话,应该有set get方法等其他规范,建议你先用最简单的方法调用来实现吧

你的代码我没看明白,我写一下我的逻辑,你做个参考:

public class ValueFeedBack {

public static void main(String[] args) {

show();

}

public static void show(){

Scanner scanner = new Scanner(System.in);

System.out.println("您的会员卡是金卡么?(是请输1,不是请输0)");

int n = scanner.nextInt();

System.out.println("您的积分是多少?(请输入整数)");

int m = scanner.nextInt();

if(n==1){

if(m=1000){

System.out.println("反馈500积分");

}else if(m1000){

System.out.println("您的积分不足,尚不能反馈积分");

}else{

System.out.println("您的输入有误");

}

}else if(n==0){

if(m=5000){

System.out.println("反馈500积分");

}else if(m5000){

System.out.println("您的积分不足,尚不能反馈积分");

}else{

System.out.println("您的输入有误");

}

}else{

System.out.println("您的输入有误");

}

}

}


分享标题:java金卡积分反馈代码 会员积分系统java
文章链接:http://kswsj.cn/article/ddioodg.html

其他资讯