1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
import
java.util.Scanner;
public
class
A02 {
/**
* @param args
*/
public
static
void
main(String[] args) {
// TODO Auto-generated method stub
Scanner input =
new
Scanner (System.in);
System.out.println(
"请输入是否是会员(y / n):"
);
String choice=input.next();
System.out.println(
"请输入消费金额:"
);
double
money=input.nextInt();
if
(choice.equals(
"y"
)){
if
(money>
200
){
money=(money*
0.75
);
}
else
{
money=money*
0.8
;
}
}
else
{
if
(money>
100
){
money=money*
0.9
;
}
}
System.out.println(
"实际支付:"
+money);
}
}
|
本文转自 Y幕徐 51CTO博客,原文链接:http://blog.51cto.com/765133133/1420161