网创优客建站品牌官网
为成都网站建设公司企业提供高品质网站建设
热线:028-86922220
成都专业网站建设公司

定制建站费用3500元

符合中小企业对网站设计、功能常规化式的企业展示型网站建设

成都品牌网站建设

品牌网站建设费用6000元

本套餐主要针对企业品牌型网站、中高端设计、前端互动体验...

成都商城网站建设

商城网站建设费用8000元

商城网站建设因基本功能的需求不同费用上面也有很大的差别...

成都微信网站建设

手机微信网站建站3000元

手机微信网站开发、微信官网、微信商城网站...

建站知识

当前位置:首页 > 建站知识

java满减打折代码 打折java实现

用java写出商品打折程序

尝试解答一下,这个里面还有老年和教师的判断就省略,主要是打折的代码

创新互联-云计算及IDC服务提供商,涵盖公有云、IDC机房租用、成都服务器托管、等保安全、私有云建设等企业级互联网基础服务,沟通电话:028-86922220

import java.util.Scanner;

class Test{

public static void main (String[] args){

Scanner sc = new Scanner(System.in);

System.out.println("请输入消费的金额:");

double oldprice = sc.nextDouble();

double newprice;

if(oldprice = 2000){

newprice = oldprice * 春笑0.85;

}else if(oldprice = 1000  oldprice  2000){

伍做       newprice = oldprice * 0.9;

}else

newprice = oldprice;

Judge jud = new Judge();

if(jud.isTeacher()|| jud.isOldman())

newprice = newprice * 0.95;

System.out.println("打折后的价格是:" + newprice);

System.out.println("折扣的程度是: " + newprice / oldprice);

}

}

class Judge{

public boolean isTeacher(){

boolean isTeacher = false;

return isTeacher;

}

public boolean isOldman(){

boolean isOld = false;

腔森衡      return isOld;

}

}

求java代码,关于会员折扣的

boolean user=true;

double jg=100;

int xfcount;

三个变凳碰量自己吵搜决定升粗历

if(user){

jg*0.9;

}

if(user==falsexfcount200){

jg*0.9;

}

if(user==truexfcount200){

jg*0.8;

}

求大神帮忙,谢谢!!!!!(要Java代码)

//第一题的答案:

import java.util.Scanner;

public class test {

public static void main(String[] args)

{

System.out.println("输入购买金额:");

Scanner input=new Scanner(System.in);

double a=input.nextDouble();

System.out.println("输入顾客类型(会员或普通):");

String b=input.next();

if(b=="会员")

{

if(a=100)

{

a=a*0.8;

System.out.println("需付款:"+a);

}

else

{

System.out.println("携州需付款:"+a);

}

}

if(b=="普通")

{

if(a=200)

{

a=a*0.75;

System.out.println("需付款:"+a);

}

else

{

System.out.println("需付款:"+a);

}

}

}

}

//下面是第二题答案:

public class test {

public static void main(String[] args)

{        陵烂    

for(int i = 0; i  3; i++) 

for(int x = i + 1; x  3; x++) 

System.out.print(" "); 

for(int y = 0; y  (i + 1) * 2 - 1; y++) 

System.out.print("*"); 

System.out.println(); 

尺隐漏      for(int i = 0; i  4; i++) 

for(int x = 0; x  i; x++) 

System.out.print(" "); 

for(int y = i; y  2 * 4 - i - 1; y++) 

System.out.print("*"); 

System.out.println(); 

}

}

}


分享标题:java满减打折代码 打折java实现
URL分享:http://bjjierui.cn/article/ddpgede.html

其他资讯