编辑代码

package org.open.java;
public class InstantNoodle extends Product {
	public InstantNoodle(String name,float price,int count) {
		super(name,price,count);//调用父类的构造方法
	}	
    @Override
    public float discount() {
    	float totalPrice=this.getPrice()*this.getCount();
    	
    	if (totalPrice>20.0) {
    		totalPrice=totalPrice-2;
    	}
    	return totalPrice;
    	    }
}