一个蓄水池,容纳10000吨水,有三个注水口和一个排水口,每个注水口没小时注水15吨,排水口每小时排水8吨,多用线程模拟,测算注水口和排水口全开的情况下,多久注满水池? 要求:需要建立一个注水口类,new三个注水口,一个出水口类,还需要一个监控,监控什么时候水池注满,注水口和出水口停止  。刚学到多线程,老师让我多理解面向对象,所以就出了这道题
                    
                    
                2 回答
 
                    
                    
                            午后的咖啡lslin
                            
                                
                            
                        
                        
                                                
                    TA贡献5条经验 获得超1个赞
package TextView;
public class ImoocText {
 public static void main(String[]args) {
  int InOne = 15;
  int InTwo = 15;
  int InThree = 15;
  int Out = 8;
  int All = 10000;
  int plus = InOne + InTwo + InThree - Out;
  int Time = All / plus;
  System.out.println(Time+"小时");
 }
}
注意改一下包名和类名,不然没法运行
                            添加回答
举报
0/150
	提交
		取消
	
