电影打折java代码 基于javaweb的电影购票系统

用java写出商品打折程序尝试解答一下 , 这个里面还有老年和教师的判断就省略 , 主要是打折的代码
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 = 1000oldprice2000){
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;
}
}
求大神帮忙,谢谢?。。。。。ㄒ狫ava代码)//第一题的答案:
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; i3; i++)
{
for(int x = i + 1; x3; x++)
{
System.out.print(" ");
}
for(int y = 0; y(i + 1) * 2 - 1; y++)
{
System.out.print("*");
}
System.out.println();
}
for(int i = 0; i4; i++)
{
for(int x = 0; xi; x++)
{
System.out.print(" ");
}
for(int y = i; y2 * 4 - i - 1; y++)
{
System.out.print("*");
}
System.out.println();
}
【电影打折java代码 基于javaweb的电影购票系统】}
}
求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代码的介绍就聊到这里吧,感谢你花时间阅读本站内容,更多关于基于javaweb的电影购票系统、电影打折java代码的信息别忘了在本站进行查找喔 。

    推荐阅读