交个作业.
来源:2-4 编程练习
千華2748110
2020-08-30 10:53:07
package MaxDome;
public class DisCountDemo {
/*总价在100以下,不打折
* 总价100带199之间,打9.5折
* 总价在两百以上,打8.5折
*/
public void discount(float a) {
if(a<100) {
System.out.println("无折扣");
}else if(a>=100&&a<=199) {
a=a*0.95f;
System.out.println("折后价钱"+a);
}else {
a=a*0.85f;
System.out.println("折后价钱"+a);
}
}
public static void main(String[] args) {
//定义对象放入公式里面
DisCountDemo dis=new DisCountDemo();
float a=150;
dis.discount(a);
}
}
1回答
好帮手慕小尤
2020-08-30
已完成练习,棒棒哒!继续加油!
祝学习愉快!