我做了一个"JugsState“类,它存储两个水罐的当前状态,即jug1中有多少升水,jug2中有多少升水。此外,我想存储的最大水量,每个水壶可以容纳,这是我将从用户作为输入。它维护了max_jug变量在类JugsState中的封装?class JugsState private static final int max_jug1,max_jug2;
private int jug1,jug2; //storesJugs
You are given two jugs with capacities jug1Capacity and jug2Capacity liters.Pour water from one jug into another till the other jug is completely full, or the first jug itself isExample -
Input: jug1Capacity = 3, jug2Capacity = 5, targe