import javax.swing.*; import java.util.*; public class main { public static void main(String [] args) { LinkList woodList = new LinkList(); Stack MerantiStack = new Stack(); Stack ChengalStack = new Stack(); Stack tempStack = new Stack(); Stack currStack = new Stack(); JOptionPane j = new JOptionPane(); for(int i = 0;i<3;i++) { char woodtype = j.showInputDialog(null,"Enter Wood type Either C for Chengal and M for Meranti").charAt(0); float width = Float.parseFloat(j.showInputDialog(null,"Enter Width:")); float length = Float.parseFloat(j.showInputDialog(null,"Enter Length:")); float height = Float.parseFloat(j.showInputDialog(null,"Enter height:")); wood wd = new wood(woodtype,width,length,height); woodList.insertAtBack(wd); } wood w ; Object data = woodList.getFirst(); while(data!=null) { w = (wood)data; if (w.getWoodType() == 'M' || w.getWoodType() == 'm') { MerantiStack.push(data); } else if (w.getWoodType() == 'C' || w.getWoodType() == 'c') { ChengalStack.push(data); } data = woodList.getNext(); } int bigMeranti = smallMeranti bigChengal = smallChengal
0, = 0, 0, = 0,
tMeranti = 0, tChengal = 0, tBig = 0, tSmall = 0, allTotal = 0; while(!MerantiStack.isEmpty()) { data = MerantiStack.pop(); w = (wood)data; if (w.getWidth() >= 6.0 && w.getHeight() >=8.0) { bigMeranti++; } else { smallMeranti++; } tempStack.push(data); } while(!ChengalStack.isEmpty()) { data = ChengalStack.pop(); w = (wood)data; if (w.getWidth() >= 6.0 && w.getHeight() >=8.0) { bigChengal++; } else { smallChengal++; } } tBig = bigMeranti+bigChengal; tSmall = smallMeranti + smallChengal; tMeranti = bigMeranti + smallMeranti; tChengal = bigChengal + smallChengal; allTotal = tMeranti + tChengal; System.out.println("TYPE TOTAL");
BIG SIZE
SMALL SIZE
System.out.println("Meranti "+bigMeranti+" "+smallMeranti+" "+tMeranti); System.out.println("Chengal "+bigChengal+" "+smallChengal+" "+tChengal);
System.out.println("TOTAL "+tSmall+" "+allTotal);
}
}
"+tBig+"